Last active
November 5, 2023 13:38
-
-
Save mortenson/538027ef218a52e190be7b9b2c17a3ca to your computer and use it in GitHub Desktop.
List all Docker Compose projects currently running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker ps --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| sort | uniq |
You need to throw a sort
in before the call to uniq
to ensure that you don't end up with duplicates because of order
@daveisfera done! thanks
or just use sort -u
thanks
Also works for me, is a little bit shorter
docker compose ls --format json | jq '.[].Name' -r
Thank you so much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks!