Skip to content

Instantly share code, notes, and snippets.

@cmheisel
Created January 14, 2015 21:20
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 cmheisel/6380025dd377472edf07 to your computer and use it in GitHub Desktop.
Save cmheisel/6380025dd377472edf07 to your computer and use it in GitHub Desktop.
Docker cleanup commands
# Kill exited containers and orphaned images, the kind, gentle way
alias dockercleancontainers="docker rm \$(docker ps -a --no-trunc | grep 'Exit' | awk '{print \$1}')"
alias dockercleanimages='docker rmi $(docker images -f dangling=true -q)'
alias dockerclean='dockercleancontainers && dockercleanimages'
# Kill all containers and all images with impunity. Dust off and nuke the site from orbit... only way to be sure
alias rmcont='docker rm $(docker ps -a -q)'
alias rmis='docker rmi -f $(docker images -a -q)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment