Docker disk usage and safe space recovery
Disk pressure can come from images, writable container layers, volumes, build caches, logs or other host files. Start with measurement, not deletion. Docker’s disk-usage report describes data known to its daemon; host free space and inode availability require separate evidence. An inode represents a filesystem object, so many tiny files can exhaust inodes while bytes remain available.
Worked storage scenario
Use the synthetic scenario offline first. No real data, daemon changes, host mounts or production resources are required. Commands, if shown, are documented examples rather than observed output. Any real Docker check requires an approved disposable context. Keep the exercise offline. For any separately authorized Docker verification, identify the effective endpoint (including DOCKER_HOST and DOCKER_CONTEXT) before sending even read-only Engine requests. Record server version and platform; redact sensitive metadata.
Read-only inspection commands (not executed)docker context showdocker system dfdocker system df -vSynthetic observations: free bytes=12 GiB; free inodes=0Image X: referenced by stopped containerVolume Y: no attached container; business archiveAfter confirming the intended isolated context, docker system df summarizes Docker-managed usage; -v requests more detailed per-object information. Shared image layers make simple addition of displayed image sizes misleading. The report’s reclaimable estimate is not a promise of exact host bytes freed, nor evidence that a resource is disposable. In the example, zero free inodes is a useful lead even though bytes remain. Investigate logs, caches and small-file growth with platform-appropriate read-only filesystem metrics in an approved environment. Image X still has a container reference; volume Y may be valuable despite being unattached. Obtain owner approval, verify backups and remove only specifically identified lab-owned resources. Recheck actual host and Docker metrics after the change; never manually delete Docker-managed storage directories. Free inodes are filesystem-specific; confirm the affected filesystem actually backs the failing path. Compare actual free bytes and inode counts before and after any approved targeted action. No reclaim estimate is a deletion authorization.
Common mistake
An unused or reclaimable label does not mean safe to delete. Broad pruning is not a routine storage fix; determine the owner and recovery requirements first.
Manual practice
Identify the likely capacity constraint and explain why neither X nor Y should be removed automatically. Write a three-step measurement, approval and verification plan.
Worksheet: lab-fixtures/docker-storage-engineering/07-disk-usage/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Docker disk usage and safe space recovery — Knowledge check
Reason about storage behavior and recovery evidence.
On the affected filesystem, what can explain failure to create a file despite available bytes?
What does docker system df -v provide?
An unattached volume holds business archives. What is the correct next step?