Last active
December 5, 2018 23:40
-
-
Save SkypLabs/56192dfd2750761c4520765ab051398e to your computer and use it in GitHub Desktop.
Scripts for removing untagged Docker images and exited Docker containers
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
#!/usr/bin/env bash | |
docker ps -a | grep 'Exit' | awk '{print $1}' | xargs docker rm |
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
#!/usr/bin/env bash | |
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These two scripts can now be replaced with
docker container prune
anddocker image prune
. See https://docs.docker.com/config/pruning/.