Running out of disk space? Docker, clean up after yourself!

When using Docker extensively and switching a lot between projects, types & versions of images you might notice quickly huge chunks of disk space disappearing. This is because Docker keeps all images & containers in cache. And it doesn't clean them up out of the box.

So once in a while I like to purge my cache and clean it up. Stating the obvious here but this has as side effect that you might need to re-download and re-build some images next time you want to spin up a container and thus will have to wait a bit longer.

To clean up your entire docker cache, just run the following command, at the prompt answer y.

docker system prune -a

⚠️ Note: this command will remove all non active containers, networks not in use by at least 1 active container, images not in use by at least 1 active container & the build cache.


In my case it cleaned up a nice 13.5GB of images, containers and more. That's pretty good huh!