-
-
Save pasystem/edace3a51022e105d6d895e65c4119a4 to your computer and use it in GitHub Desktop.
Remove old docker containers and images
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
# Remove old docker containers | |
docker rm $(docker ps --no-trunc -aq) | |
# Remove unreferenced images | |
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi | |
#OR | |
#alias dockercleancontainers="docker ps -a -notrunc| grep 'Exit' | awk '{print \$1}' | xargs -L 1 -r docker rm" | |
#alias dockercleanimages="docker images -a -notrunc | grep none | awk '{print \$3}' | xargs -L 1 -r docker rmi" | |
#alias dockerclean="dockercleancontainers && dockercleanimages" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment