Docker left no space on server

Docker, Dokku, Gist ・ Jan 9, 2024

Let’s say you run a Docker or Dokku on your server and suddenly you find that you have 0 free space left on the disk. Things happen.

Most certanly, Docker may have taken all of the available space. You can even check this by installing ncdu and running it.

I’m almost sure you will see a lot of occupied GiB in /var/lib/docker/overlay2.

So here is the command you can run to clean it up.

docker system prune -a -f

It is used to clean up Docker resources on your system:

So, when you run docker system prune -a -f, Docker will forcefully remove all unused images on your system, including those with no tags (dangling images).

Be cautious when using the -f flag, as it will not prompt you for confirmation, and you might lose data if you have important, unused images.