A Linux Story: How to Check Which Docker Container is Using the Space

Опубликовано: 26 Октябрь 2024
на канале: zubilitic
67
2

I had an issue a couple of days ago in which I had the /docker filesystem full and unable to pinpoint exactly which docker container is using it.
Fortunately docker comes with powerful utilities to help you out with this.

In this short video you will see how to use docker commands to check the space usage. Also, I will show you how to see which container is using a special local volume because our space in this example is occupied by a local volume.

Enjoy and feel free to ask any question in the comments section.


How to check how docker is using the system space:
The following commands even if they are close they provide different output. The -v option will give you way more details
docker system df -v
docker system df

In this case, the problem was with a local volume so while the previous command can tell you which local volume is using the space, the following one will show you which docker container is using that local volume so you will know exactly what to cleanup.
How to check which container is using a local volume:
In this example, local volume name is 0518adc5fe115812b848411339cfb54df81471dcf75e59c9dcef512130bdf713.
docker ps -a --filter volume=0518adc5fe115812b848411339cfb54df81471dcf75e59c9dcef512130bdf713

#docker #cli #linux #container