Skip to content

Instantly share code, notes, and snippets.

@ramboldio
Created November 2, 2016 11:21
Show Gist options
  • Save ramboldio/daded3fdd36737e0b39cb8eaf23eacd6 to your computer and use it in GitHub Desktop.
Save ramboldio/daded3fdd36737e0b39cb8eaf23eacd6 to your computer and use it in GitHub Desktop.
Cleanup old Docker Stuff on your machiene
# ~/.bash_aliases
# Kill all running containers.
alias dockerkillall='docker kill $(docker ps -q)'
# Delete all stopped containers.
alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
# Delete all untagged images.
alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'
# Delete all stopped containers and untagged images.
alias dockerclean='dockercleanc || true && dockercleani'
#Delete all docker Volumes
alias dockercleanv = 'docker volume ls -qf dangling=true | xargs -r docker volume rm'
alias dockercleanall = 'dockerkillall && dockerclean && dockercleanv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment