SOLVED /var/lib/docker/overlay2 getting full
I had some trouble with my Cloudron. Found out that the disk was getting full, and managed to fix that with the instructions at https://cloudron.io/documentation/server/#recovery-after-disk-full
However, I investigated a bit what was taking up so much space. It turns out that by far the biggest culprit is /var/lib/docker/overlay2 which has about 450 subfolders and uses 16 GB of my 45 GB drive. (determined with "du -x", i.e. skipping anything that's not on the root file system).
I use only 6 apps, and the appsdata folder is only about 7.5 GB. Is it normal that the /var/lib/docker/overlay2 takes up twice as much space as my appsdata? My understanding is that that folder contains the docker containers of the apps and whatever other containers are running, so it seems odd that it's that much larger than appsdata.
Is it possible that some old content is not cleaned up or duplicated when the VPS is rebooted? I had to reboot a few days ago (for the first time in months), just wondering if that has any connection. It was a hard reboot, i.e. equivalent to just cutting the power without shutting down.
For a start, docker images are often quite large, composed of a multitude of filesystem layers on top of each other. To mitigate the problem a bit, all Cloudron apps share the same base image, that helps a bit. The appsdata folder really only contains the data from within the apps, so that heavily depends on your own usage. The application code, so to speak, is inside those docker images.
du -hcs /var/lib/dockerwill give incorrect disk usage output because of the overlay filesystem (this seems to be some linux/fs limitation).
I have a follow up question: Will the size of the docker images grow infinitely? Or is there any way to keep them below a certain limit?
The docker images as such wont grow at all. But everytime an app gets installed, new images will get downloaded and thus the overall space used for images changes. Same on app uninstallation, the docker images of that app will get purged and space will be freed up.
@nebulon Okay. Thanks for clarification!