Docker Community Forums

Share and learn in the Docker community.

Docker var/lib/docker

Dear all,

docker saves a lot MB in the above mentioned folder in ubuntu. Which folder in there can be deleted to free up more space? The last time I deleted overlay2 but then I had to reinstall Docker.
How can I only delete these temp data which docker creates but not deleting the files docker needs to run?

Best,

Do not delete any files or folders inside /var/lib/docker unless you know what you are doing.

You can reclaim space using the docker cli:
If you build a lot of images, you can cleanup the build cache: docker build prune
If you have a lot of orphaned images in your local image cache, you can clean them up by docker image prune (if you feel bold, you cann add a -a flag at the end to not only remove dangline images, but also every image not currently used by a container).
And finaly we have docker system prune (if you feel brave, you can add the -a flag at the end as well :))

And then there are container logs going wild… this needs to be fixed in the image!