Skip to content

Instantly share code, notes, and snippets.

@daveslutzkin
Last active August 29, 2015 14:08
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 daveslutzkin/ed4482ac372e129abfb7 to your computer and use it in GitHub Desktop.
Save daveslutzkin/ed4482ac372e129abfb7 to your computer and use it in GitHub Desktop.
Clean up docker containers and images
# Frees up a lot of disk space by removing almost everything from the docker cache.
# Get rid of all unnamed containers.
sudo docker ps -a | grep -v ":" | grep -v "ID" | awk '{ print $1 }' | sort | uniq | xargs sudo docker rm
# Get rid of all unnamed images.
sudo docker images | grep "^<none>" | awk '{ print $3 }' | xargs sudo docker rmi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment