What is the best way to maintain disk usage by Docker? Namely, how do you prevent var/lib/docker/overlay2 from endlessly filling up? I’ve seen plenty of insights on this, but no definitive answer. I am using Docker 20.10.2 on Ubuntu 20.04.1 running 2 containers: a web server (Nginx + Gunicorn + Django) and a postgreSQL Database. NOTE: I am also using Docker with Dokku here.
- List item
docker system prune and pruned images and containers separately as well (with each combination of flags). These reclaimed minimal space.
- tried to manually delete some of the directories in overlay2 (broke Docker installation)
- uninstalled, reinstalled Docker and rebuilt my containers with new images, and overlay2 started to balloon again immediately.
It looks like the directory contains images, yet the
docker image commands weren’t helping me reclaim anything.
How can I safely reclaim overlay2 right now? and Is there any way to prevent this issue from arising in the future?