Skip to content

Instantly share code, notes, and snippets.

@SunlightJoe
Last active February 2, 2018 19:06
Show Gist options
  • Save SunlightJoe/3fa30a4ca9dcdc63a23c00a270346ec2 to your computer and use it in GitHub Desktop.
Save SunlightJoe/3fa30a4ca9dcdc63a23c00a270346ec2 to your computer and use it in GitHub Desktop.
#!/bin/bash -x
# Docker sometimes decides to not clean up correctly,
# and it will leave stuff behind. This can block rebuilds and cleans.
# Sometimes the simplest solution is to burn it all down and start over.
docker ps -aq | xargs -r docker stop
docker ps -aq | xargs -r docker rm
docker network prune -f
docker images --filter dangling=true -qa | xargs -r docker rmi -f
docker volume ls --filter dangling=true -q | xargs -r docker volume rm
docker images -qa | xargs -r docker rmi -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment