---
title: "docker system df: Finding What Eats Your Disk Space"
date: "2026-11-17T08:00:00+07:00"
description: "Learn how to use docker system df and its verbose flag -v to analyze Docker disk usage across images, containers, volumes, and build cache, and accurately calculate reclaimable space."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/docker-system-df-find-disk-usage.jpg"
alt: "Terminal window executing docker system df command showing Docker storage breakdown"
tags: ['docker', 'containers', 'disk-usage', 'docker-cli', 'devops']
---

Over time, Docker hosts can run low on disk space as images, containers, volumes, and BuildKit build caches accumulate. Before deleting files blindly, you need to identify exactly which Docker subsystem is consuming disk space and how much of it can be safely reclaimed. The `docker system df` command provides a high-level overview and granular breakdown of disk usage across your Docker daemon.

## Basic Disk Usage Overview

Running `docker system df` produces a concise tabular report showing space usage divided into four distinct categories: Images, Containers, Local Volumes, and Build Cache.

```bash
docker system df
```

Sample output:

```text
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          18        5         4.82GB    3.15GB (65%)
Containers      8         2         1.24GB    850MB (68%)
Local Volumes   12        4         15.4GB    9.2GB (59%)
Build Cache     42        0         8.10GB    8.10GB (100%)
```

### Understanding the Columns

- **TYPE**: The Docker resource category.
- **TOTAL**: Total count of resources managed by the daemon.
- **ACTIVE**: Count of resources currently associated with at least one running or created container.
- **SIZE**: Total disk footprint consumed by all items in this category.
- **RECLAIMABLE**: Disk space that would be freed if inactive resources were pruned, along with the percentage of space that is currently unused.

## Detailed Breakdown with Verbose Mode (`-v`)

While the basic output highlights high-level space consumers, the `--verbose` or `-v` flag breaks down every individual resource within each category:

```bash
docker system df -v
```

### 1. Images Breakdown

```text
Images space usage:

REPOSITORY          TAG       IMAGE ID       CREATED        SIZE      SHARED SIZE   UNIQUE SIZE   CONTAINERS
golang              1.24      a1b2c3d4e5f6   2 weeks ago    840MB     300MB         540MB         1
node                22-alpine 9f8e7d6c5b4a   1 month ago    180MB     0B            180MB         0
python              3.12      1a2b3c4d5e6f   3 weeks ago    1.02GB    400MB         620MB         2
```

- **SHARED SIZE**: Disk space shared with other images via common base layers (e.g., standard Debian or Alpine base layers).
- **UNIQUE SIZE**: Disk space unique to this specific image tag.
- **CONTAINERS**: Number of containers currently instantiated from this image. If `0`, the image is dangling or unused and can be reclaimed.

### 2. Containers Breakdown

```text
Containers space usage:

CONTAINER ID   IMAGE          COMMAND                  LOCAL VOLUMES   SIZE      CREATED       STATUS       NAMES
8f9e0d1c2b3a   postgres:16    "docker-entrypoint.s…"   1               150MB     2 days ago    Up 2 days    db-prod
4a3b2c1d0e9f   node:22-alpine "npm start"              0               1.09GB    5 days ago    Exited (0)   app-test
```

- **SIZE**: Represents the writable container layer (copy-on-write layer). Large sizes here indicate that applications are writing logs or temporary files directly to the container's writable filesystem instead of mounted volumes.

### 3. Local Volumes Breakdown

```text
Local Volumes space usage:

VOLUME NAME                                                        LINKS     SIZE
app_data                                                           1         4.2GB
db_postgres_data                                                   1         11.2GB
dangling_vol_98234                                                 0         9.2GB
```

- **LINKS**: Number of containers attached to this volume. Volumes with `0` links are unattached and candidate for cleanup.

### 4. Build Cache Breakdown

```text
Build Cache usage: 8.10GB

CACHE ID       CACHE TYPE     SIZE      CREATED        LAST USED      USAGE COUNT   SHARED
k3j2h1g0f9e8   internal       1.2GB     3 days ago     4 hours ago    5             true
v9u8t7s6r5q4   exec.cachemount 2.5GB    1 week ago     5 days ago     1             false
```

BuildKit caches intermediate build steps, layer tarballs, and build mounts (`--mount=type=cache`). Unused build cache can grow significantly over time on CI/CD runners and developer workstations.

## Formatting Output for Scripting

You can extract specific metrics programmatically using Go template formatting with the `--format` flag:

```bash
# Export disk usage summary as JSON
docker system df --format '{{json .}}'

# Print total volume size and reclaimable percentage
docker system df --format "{{.Type}}: {{.Size}} (Reclaimable: {{.Reclaimable}})"
```

## Reclaimed Space Calculation

Docker calculates reclaimable space strictly based on dependency graphs:

1. **Unused Images**: Images not referenced by any existing container (running or stopped).
2. **Stopped Containers**: Stopped containers and their writable copy-on-write layer.
3. **Dangling Volumes**: Volumes not attached to any container (running or stopped).
4. **Expired Build Cache**: BuildKit cache records that exceed age or memory retention thresholds.

**Takeaway:** `docker system df` gives instant visibility into Docker storage bottlenecks. Always run `docker system df -v` before executing cleanup commands to pinpoint whether dangling images, stopped container writable layers, unattached volumes, or BuildKit cache are consuming your host disk.

## Sources

- [Docker Docs: docker system df](https://docs.docker.com/reference/cli/docker/system/df/)
- [Docker Docs: Prune unused Docker objects](https://docs.docker.com/config/pruning/)
- [Docker Docs: BuildKit cache management](https://docs.docker.com/build/cache/)