Created
September 11, 2017 13:45
-
-
Save marvingreenberg/0b5fb94bce726d0d22f5432b3cd796be to your computer and use it in GitHub Desktop.
Docker Cleanup
This file contains hidden or 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
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