Skip to content

Instantly share code, notes, and snippets.

@simahawk
Created September 19, 2016 07:41
Show Gist options
  • Save simahawk/7b8bd5efe72b39e548034b887b0d9fdd to your computer and use it in GitHub Desktop.
Save simahawk/7b8bd5efe72b39e548034b887b0d9fdd to your computer and use it in GitHub Desktop.
docker commands cheatsheet
# remove all images "months" old
docker images -a | grep 'months ago' | awk '{print $3}' | xargs --no-run-if-empty docker rmi
# remove all dangling images
docker rmi $(docker images -f "dangling=true" -q)
# remove all containers "months" old
docker ps -a | grep 'months ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
# remove all containers exited
docker rm -v $(docker ps -a -q -f status=exited)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment