The Linux Page

My hard drive looks full but I have nearly nothing install a just a few dockers...

Istanbul, it's full.

Where Did My Disk Space Go?

I suppose with the title on this page, you already understood that Docker is the culprit... Yep! It's using a lot of disk space to store all of those images. One image can very easily be over 1Gb and if you have a VirtualBox system with many images, you end up eating a lot of your disk space very quicly!

How Did You Discover the Issue?

I ran the following command:

sudo ncdu -qx /

Did some other work for a little while, then checked the results. By default, the largest folder was shown at the top:


You can simply select the folder and hit enter to go inside. I did that a few times and found out that the directory with the most data was owned by Docker.

How Did You Resolve the Issue?

There is actually a very simple command line option to prune all the docker images that are not currently in use:

docker image prune

The command asks you to confirm your move. Say yes and then check your used disk space again:

df .

In my case, the disk space used went from 91% to 51% and I gave 256Gb of space on that VPN disk!

Next I think I'll look at having another disk where I can place the Docker files. That way I can make sure that my boot drive doesn't get filled up that fast. Docker may know to auto-delete some old files, but from what I've seen, it does not seem to do it on its own. So if you build many dockers all the time, running prune once in a while is certainly a good idea all around.