0
0
DockerHow-ToBeginner · 3 min read

How to Use docker system df to Check Disk Usage

Use the docker system df command to see how much disk space Docker is using for images, containers, volumes, and build cache. It gives a summary of storage usage so you can manage space effectively.
📐

Syntax

The basic syntax of the docker system df command is simple and has optional flags to customize output.

  • docker system df: Shows disk usage summary.
  • --verbose: Shows detailed information about each object.
  • --format: Formats output using a Go template.
bash
docker system df [OPTIONS]

Options:
  --verbose    Show detailed information on space usage
  --format string   Format output using a Go template
💻

Example

This example runs docker system df to display a summary of disk usage by Docker objects like images, containers, 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

Common mistakes when using docker system df include:

  • Expecting it to clean space automatically — it only reports usage.
  • Not using --verbose when detailed info is needed.
  • Confusing SIZE with actual reclaimable space.

To free space, use docker system prune separately.

bash
docker system df --verbose
Output
Images space usage: REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS alpine latest 7a8c8a1e7f3b 2 weeks ago 5.57MB 0B 5.57MB 1 ubuntu 20.04 1d622ef86b13 3 weeks ago 72.9MB 0B 72.9MB 0 Containers space usage: CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED STATUS NAMES 3c1a2b3c4d5e alpine "/bin/sh" 0 2MB 2 days ago Up 2 days friendly_morse Local Volumes space usage: VOLUME NAME LINKS SIZE my_volume 1 200MB
📊

Quick Reference

OptionDescription
docker system dfShow disk usage summary
docker system df --verboseShow detailed usage per object
docker system df --formatFormat output with Go template
docker system pruneRemove unused data to free space

Key Takeaways

Use docker system df to check Docker disk usage for images, containers, volumes, and build cache.
Add --verbose to see detailed information about each Docker object.
The command only reports usage; use docker system prune to clean up space.
Understand the difference between total size and reclaimable space shown in the output.
Use --format to customize output for scripts or automation.