Skip to content

Instantly share code, notes, and snippets.

@mortenson
Last active August 28, 2024 21:42
Show Gist options
  • Save mortenson/538027ef218a52e190be7b9b2c17a3ca to your computer and use it in GitHub Desktop.
Save mortenson/538027ef218a52e190be7b9b2c17a3ca to your computer and use it in GitHub Desktop.
List all Docker Compose projects currently running
#!/bin/bash
docker ps --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| sort | uniq
@robozb
Copy link

robozb commented Aug 2, 2023

Thank you so much!

@mickythompson
Copy link

mickythompson commented Aug 28, 2024

Thank you! You can add '-a' to show all projects, including those with all stopped containers.

docker ps -a --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| sort | uniq

Also, you can use '-all' on the command that @ohihn suggested.

docker compose ls --all --format json | jq '.[].Name' -r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment