Skip to content

Instantly share code, notes, and snippets.

@punkdata
Last active August 2, 2017 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punkdata/61e377e787eaa763f6154ac53424492e to your computer and use it in GitHub Desktop.
Save punkdata/61e377e787eaa763f6154ac53424492e to your computer and use it in GitHub Desktop.
Docker cmd helper scripts & commands
#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