Skip to content

Instantly share code, notes, and snippets.

@marvingreenberg
Created September 11, 2017 13:45
Show Gist options
  • Save marvingreenberg/0b5fb94bce726d0d22f5432b3cd796be to your computer and use it in GitHub Desktop.
Save marvingreenberg/0b5fb94bce726d0d22f5432b3cd796be to your computer and use it in GitHub Desktop.
Docker Cleanup
List all exited containers
docker ps -aq -f status=exited
Remove stopped containers
docker rm $(docker ps -aq --no-trunc)
This command will not remove running containers, only an error message will be printed out for each of them.
Remove dangling/untagged images
docker rmi $(docker images -q --filter dangling=true)
Remove containers created since ( or --before) a specific container
docker rm $(docker ps --since <container id> -q)
Use --rm for docker build to remove intermediate build images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment