How to Check Disk Usage in Docker: Commands and Examples
Use the
docker system df command to check disk usage in Docker. It shows space used by images, containers, volumes, and build cache in a clear summary.Syntax
The main command to check disk usage in Docker is docker system df. It summarizes the disk space used by Docker objects.
docker system: Docker command group for system-wide operations.df: Stands for disk free, shows disk usage summary.
bash
docker system df
Example
This example runs docker system df to display disk usage of Docker images, containers, local volumes, and build cache.
bash
docker system df
Output
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 5 2 3.45GB 1.2GB (34%)
Containers 3 1 150MB 100MB (66%)
Local Volumes 4 3 500MB 200MB (40%)
Build Cache 0 0 0B 0B
Common Pitfalls
Some common mistakes when checking Docker disk usage:
- Expecting
docker system dfto show detailed file-level usage — it only summarizes by object type. - Not running the command with sufficient permissions, which may hide some data.
- Confusing disk usage of Docker with host system disk usage; Docker manages its own storage.
To clean up unused data and free space, use docker system prune carefully.
bash
docker system df # Wrong: expecting detailed file sizes # Right: use this command for summary only
Quick Reference
Summary tips for checking Docker disk usage:
docker system df: Shows disk usage summary.docker system df -v: Shows detailed info per image, container, volume.docker system prune: Removes unused data to free space.- Run commands with proper permissions (usually as root or with sudo).
Key Takeaways
Use
docker system df to quickly see Docker disk usage summary.Add
-v flag for detailed disk usage per object.Run commands with proper permissions to see full data.
Docker disk usage is separate from host system disk usage.
Use
docker system prune to clean unused Docker data safely.