Docker with 2 containers growing out exceedingly
So I installed Docker on a Rocky Linux VM with a 10GB hard drive (runs on Proxmox) for two small docker applications (rsshub & tinytinyrss). The applications were not taking much more than 2.5GB of hard drive space at the moment of installation, and the VM had plenty of space left in /
Fast forward today, I keep getting notifications from this VM that the hard drive is nearly full (the VM is configured to send an email notification via cron if a storage layer reaches 80% or more)... df -H reveals: Code:
Filesystem Size Used Avail Use% Mounted on Anyways, /var/lib/docker is indeed 5.8GB Code:
du -hs /var/lib/docker Code:
docker system df Code:
docker ps --size Code:
du -a /var/lib/docker | sort -n -r | head -n 20 -logs < 519MB -JSON < 7.5MB -DEB < 139MB .... 1. What is causing the filesystem to grow out of control? 2. How to clean up Docker to free up HDD space? I hope some can help me with this. Thanks |
As far as I know docker and overlayfs is ok, it is the app inside the docker container (most probably the cache of chrome or something similar).
|
You may be onto something... I have created 2 more env variables for rsshub as per their wiki (https://docs.rsshub.app/en/install/#docker-image) in the hope the cache will clear itself at some point but I am not expecting anything at this moment...
For the chrome browserless docker app, I also believe it may be the root cause... I however cant find how to clear cache, or limit its growth... If anybody has info please share. |
theoretical you may go inside the docker image and look around, as if it was a real VM. But that require some knowledge about them.
you may get some ideas (for example) here: https://phoenixnap.com/kb/how-to-ssh...cker-container |
There might be unused/dangling objects.
Have you tried to prune unused objects of docker ? check this official document : https://docs.docker.com/config/pruning/ This will help you cleanup if any unused image/container/network/volumes present in overlay directory. |
"Unused objects" won't account for this. Something inside the containerized environment must be the culprit in this case.
|
Quote:
"docker image ls" gives: Code:
REPOSITORY TAG IMAGE ID CREATED SIZE ssh into the container, I could see that /usr is taking 1.7GB, with /usr/src and /usr/lib taking most of that space... Code:
0 /bin |
These days, I've encountered a lot of software (specifically including "Chrome") that is extremely wasteful of disk space probably because the authors thereof figure that it doesn't matter. It is entirely correct to presume that the "stock" container definition also did not bother. Really, the only thing that you can do at this point is to enter the container and have a look around ... look at the configuration files, zero-in on exactly what is in (say ...) "/opt," and then exactly why.
Incidentally – this has become one of the specific reasons why I have come to dislike "Docker." In my view, it leaves you too far disconnected from what is actually going on. "The price of convenience" may turn out to be too much. However, that's just me . . . |
Quote:
Next you can use ncdu or other software to see what is in /usr and clean that manually (if possible). This is not the container, it cannot clean itself (as a VM or any other OS cannot clean the storage), but the software running inside (=chrome) which eats up your disk. Docker (and other container solutions) will encapsulate the running process by having its own environment and virtually locking out anything else. Docker can also control the used resources like RAM or CPU, see for example here: https://docs.docker.com/engine/refer...-per-container |
All times are GMT -5. The time now is 03:09 AM. |