False excessive disk usage, how to explain DF-system and DF-docker contradiction?

295 Views Asked by At

At Linux server I checked disk usage by df command and obtained big /var/lib/docker usage

Filesystem     1K-blocks     Used Available Use% Mounted on
udev             4078144        0   4078144   0% /dev
tmpfs             817484    82900    734584  11% /run
/dev/vda1      162421080 93727736  68676960  58% /
tmpfs            4087412       96   4087316   1% /dev/shm
tmpfs               5120        0      5120   0% /run/lock
tmpfs            4087412        0   4087412   0% /sys/fs/cgroup
/dev/vda15        106858     3426    103433   4% /boot/efi
none           162421080 93727736  68676960  58% /var/lib/docker/aufs/mnt/7fe...
tmpfs             817484        0    817484   0% /run/user/0

so, seems that docker (that have images with no database and no big lib or big dataset) is consuming all my disk with some trash, is it? ... And, if is it, how to clean?

But seems that the real problem is not "to clean", but to monitoring my disk usage with reliable information, I need to explain contradiction, how to explain?


Note: PostgreSQL database is external (at env not dockered), the only image in use is PostgREST. As @MagdKudama suggested, docker system df result is:

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              1                   1                   112.7MB             0B (0%)
Containers          2                   1                   0B                  0B
Local Volumes       0                   0                   0B                  0B
Build Cache         0                   0                   0B                  0B

So, this enhances the contradiction, Linux df command say other thing, (now using df -h to human comparison)

Filesystem      Size  Used Avail Use% Mounted on
...
none            155G   90G   66G  58% /var/lib/docker/aufs/mnt/7fe...

PS: thanks to @MagdKudama and this tutorial that explained 50% of the problem, now I really can say "with 100% of conviction" that it is a contradiction to be explained, by a Ubuntu 18 LTS bug or by my wrong interpretation of df information,
(none Filesystem) Mounted on /var/lib/docker.

1

There are 1 best solutions below

6
Magd Kudama On

You probably have old images in Docker. You can use commands like https://docs.docker.com/engine/reference/commandline/image_prune/ to remove unused images, old ones...

You can also run https://docs.docker.com/engine/reference/commandline/system_prune/, which will remove unused data (networks, unused images, build cache...).

For more detailed information about disk usage on Docker, you can check the command https://docs.docker.com/engine/reference/commandline/system_df/.