Skip to main content

Pierre Ozoux

I know how to clean docker!

1 min read

And I can show you!

 

docker rm -v $(docker ps -a -q)

docker rmi $(docker images -q)

docker volume rm $(docker volume ls -qf dangling=true)

 

These commands are dirty, but they are 'safe' as they will do nothing if the ressource is used.

(Don't do it in production though, unless you know what you are doing!)

Inspired from http://container42.com/2014/11/03/docker-indepth-volumes/ and http://jimhoskins.com/2013/07/27/remove-untagged-docker-images.html and also https://github.com/cpuguy83/docker-volumes and http://blog.yohanliyanage.com/2015/05/docker-clean-up-after-yourself/