Last active
August 2, 2017 14:52
-
-
Save punkdata/61e377e787eaa763f6154ac53424492e to your computer and use it in GitHub Desktop.
Docker cmd helper scripts & commands
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 all exited docker containers | |
docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs docker rm | |
# Remove all images tagged as <none> | |
docker rmi $(docker images -f "dangling=true" -q) | |
# DANGEROUS remove all images from docker | |
docker rmi $(docker images | grep "$2/\|/$2 \| $2 \|$2 \|$2-\|$2_" | awk '{print $1 ":" $2}') 2>/dev/null || echo "No images matching \"$2\" to purge." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment