Cleaning Docker Disk Space Usage

Cleaning Docker Disk Space UsageWhile testing our PMM2 Beta and other Dockerized applications, you may want to clean up your docker install and start from scratch. If you’re not very familiar with Docker it may not be that trivial. This post focuses on cleaning up everything in docker so you can “start from scratch” which means removing all your containers and their data. Make sure this is what you really want!

First, you have running (and stopped containers):

Which you can stop and remove.

You may feel like you are done at this point, but not really. You may have a lot of disk space held up in other Docker objects:

Now we can see that we have about 1GB still held up in images and the larger amount of 52GB in local volumes. To clean these up, we want to see their names, which you can do with the same “df” command:

From here you can, of course, remove volumes and images one by one, but you may choose to do this instead:

Remove All Docker Images:

And Remove all Docker Local Volumes:

We can run “docker system df” again to see if we really cleaned up everything or if anything else remains:

All clear. We can now have a fresh start with docker!

Share this post

Leave a Reply