Listing resource consumption
Over time, a Docker host can accumulate quite a bit of resources such as images, containers, and volumes in memory and on disk. As in every good household, we should keep our environment clean and free unused resources to reclaim space. Otherwise, there will come the moment when Docker does not allow us to add any more new resources, meaning actions such as pulling an image can fail due to lack of available space on disk or in memory.
The Docker CLI provides a handy little system
command that lists how much resources currently are used on our system and how much of this space can possibly be reclaimed. The command is:
$ docker system df
If you execute this command on your system, you should see an output similar to this:
TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 21 9 1.103GB 845.3MB (76%) Containers 14 11 9.144kB 4.4kB (48%) Local Volumes 14 14 340.3MB 0B (0%) Build Cache 0B ...