/var/lib/docker/overlay2 eating up all disk space


A few months ago I’ve setup Greenbone Community Container Edition with Docker successfully on Ubuntu 22.04 LTS.

All worked well until now but I haven’t used GVM for quite a while.

Now I wanted to use GVM again but saw that my complete hard disk has ran out of space.

I found out that the folder /var/lib/docker/overlay2 is eating up all my disk space.

What happened here and how can I free back disk space again?

Can I simply delete the content of the folder /var/lib/docker/overlay2?

Thanks for any help.


docker sadly keeps all images when pulling new ones. Therefore you need to do cleanups from time to time. The command to remove old images is docker image prune -f.

To drop all content generated by our container images you can run

export DOWNLOAD_DIR=$HOME/greenbone-community-container
docker-compose -f $DOWNLOAD_DIR/docker-compose.yml -p greenbone-community-edition down
docker container prune -f
docker image prune -f
docker volume prune -f

Please keep in mind that the last command docker volume prune -f will delete all stored data. You will loose all you users and scans.



thanks for your quick reply.

I assume that mainly the data container with the definitions which I pull once a day using a cron script are causing this behavior, right?

So another cron script with the docker image prune -f command for housekeeping should do the trick …

Can I execute docker image prune -f while the Greenbone containers are running?
Do I have to (or can) run this command as root?

Just take a look at your current images docker image ls. Older ones should be listed there too. If you pull a new version of an image docker keeps the old one. especially if a container using this image is still running.

Yes docker prune just removes unused and untagged images. If an image is still used in a container it keeps it. That also means after pull you need to restart the containers and then run prune.

I am sorry I can’t answer that question because it depends on your docker setup. The user needs to have access to docker’s unix domain socket.

1 Like

Hello @bricks

Thanks for the explanations which helped freeing back the disk space.

But running out of disk space seems to have broken something with the redis container …
I’ll create a new topic for this …