0

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.

Peter Krauss
  • 13,174
  • 24
  • 167
  • 304

1 Answers1

1

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/.

Magd Kudama
  • 3,229
  • 2
  • 21
  • 25
  • I do (with no stop) command `docker image prune -a` and in fact it deleted images, it say *"Total reclaimed space: 243.9MB"*... It is nothing, the `df` command shows the same. – Peter Krauss Nov 15 '19 at 11:04
  • You can also try https://docs.docker.com/engine/reference/commandline/system_prune/. Be careful and read the docs before executing it. Another question would be how many running containers do you have in your system? – Magd Kudama Nov 15 '19 at 11:05
  • There are a way to test if it is a `df` bug, a false attribution to docker usage, perhaps stopping all and checking again `df`? – Peter Krauss Nov 15 '19 at 11:05
  • Please show all "how many" commands, so I can show result in the question body – Peter Krauss Nov 15 '19 at 11:07
  • I added some extra information for you on the answer body @PeterKrauss – Magd Kudama Nov 15 '19 at 11:12
  • Thanks (!), I add to question Notes the result of docker df, that show no relevant disk usage (perfect is the expected!)... So there are a Linux `df` bug? The good question perhaps is "Why Linux `df ` command say that Docker is using all disk?" – Peter Krauss Nov 15 '19 at 11:29