Monitoring disk space usage with a breakdown by individual container ensures continuous service availability by preventing space leakages in containers with data (persistent) volumes.
While the Docker command line provides a way to obtain container sizes using the
--size flag, the command may take several minutes to complete while significantly overloading the hosts disk subsystem and slowing down API requests in the Docker engine. Besides, parsing the output of a
docker ps --size command requires handling size units (kb, mb, gb) and doesn’t expose space usage by volume.