Skip to content

Instantly share code, notes, and snippets.

@horaciod
Created December 29, 2023 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horaciod/cf236264c0e42af157eb0f74e27e4a6c to your computer and use it in GitHub Desktop.
Save horaciod/cf236264c0e42af157eb0f74e27e4a6c to your computer and use it in GitHub Desktop.
listar todos los contenedores con los nombres de proyectos de docker-compose
#!/bin/bash
## https://stackoverflow.com/questions/70915151/how-to-show-all-running-containers-created-by-docker-compose-globally-regardle
base='{{.Status}}\t{{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Ports}}\t{{.Networks}}\t{{.Mounts}}'
compose='{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.service"}}'
docker container ls --all \
--filter label=com.docker.compose.project \
--format "table $compose\t$base"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment