✦ For everyone, free.

Practical knowledge for real and everyday life

Home

19.3.1.2 Df Image Usage

A focused guide to Df Image Usage, connecting core concepts with practical Docker and container operations.

The image usage section within docker system df -v expands the Images row from the default summary into a per-image breakdown. For each image stored on the host, it reports the repository, tag, ID, age, total size, shared size, unique size, and the number of containers currently using it. This granular view makes it possible to identify exactly which images are consuming the most space and whether they are in use.

Accessing the Image Usage Section

docker system df -v

The -v flag enables verbose mode, which expands all resource types into individual entries. The Images section appears first in the output.

Image Usage Table Structure

Images space usage:

REPOSITORY          TAG          IMAGE ID       CREATED         SIZE      SHARED SIZE   UNIQUE SIZE   CONTAINERS
nginx               latest       abc123def456   2 days ago      187MB     0B            187MB         3
nginx               1.24         bcd234ef567    3 weeks ago     185MB     167MB         18MB          0
postgres            15           def456abc789   1 week ago      412MB     0B            412MB         1
postgres            14           ef5678bcde0    2 months ago    398MB     374MB         24MB          0
alpine              3.18         789abc012def   3 weeks ago     7.34MB    0B            7.34MB        0
<none>              <none>       012def345abc   5 days ago      245MB     187MB         58MB          0
REPOSITORY and TAG

Together these identify the image by its human-readable name. Images with <none> in both columns are dangling images — they lost their tag because a newer image was built or pulled with the same name and tag, leaving the old image untagged and unreferenced.

IMAGE ID

The short form of the image's SHA256 content hash, truncated to 12 characters. This ID is stable: it is derived from the image content and does not change unless the image is rebuilt.

CREATED

A human-readable timestamp indicating when the image was built or last pulled. Older images in the list are candidates for removal if they represent outdated versions no longer in use.

SIZE

The total uncompressed size of all layers in the image, as they exist when expanded on disk. This is not the compressed size shown in registry pull statistics. The SIZE column includes all layers, including those shared with other images.

SHARED SIZE

The portion of the image's total size that consists of layers also present in at least one other image on the host. Shared layers are only stored once on disk even though they contribute to the size of every image that includes them.

For example, if nginx:latest and nginx:1.24 share 167MB of base OS and common layers, each image reports that 167MB as its SHARED SIZE. However, those 167MB are only stored once on disk.

UNIQUE SIZE

The portion of the image's total size consisting of layers that are not shared with any other image. This is the disk space that would actually be freed if this image were removed (assuming no other image shares those layers).

The relationship between the three size columns is:

SIZE = SHARED SIZE + UNIQUE SIZE

When evaluating which images to remove to reclaim the most space, focus on images with a high UNIQUE SIZE, not just a high total SIZE. Removing an image with a large SIZE but mostly SHARED layers frees only the UNIQUE SIZE portion.

CONTAINERS

The number of containers — running or stopped — that were created from this image. An image with 0 containers is not actively in use and is a candidate for removal. An image with running containers cannot be removed until those containers are stopped and removed.

Layer Sharing Visualization

Consider two images that share a common base:

nginx:latest (18MB unique) Shared base (167MB) nginx:1.24 (18MB unique) Shared base (167MB) Disk: 167MB stored once + 18MB + 18MB

Although both images report 185MB as their SIZE, the host stores only 203MB total (167MB shared + 18MB + 18MB unique), not 370MB.

Identifying Unused Images

Images with CONTAINERS = 0 are not referenced by any container and are candidates for removal:

docker image prune

This removes only dangling images (those with <none> in REPOSITORY and TAG). To also remove unused tagged images:

docker image prune --all

To remove a specific image identified in the verbose output:

docker rmi nginx:1.24

If an image cannot be removed because a stopped container still references it, remove the container first:

docker container prune
docker rmi nginx:1.24

Practical Use

The image usage table in verbose mode is most useful for:

  • Identifying old image versions with zero containers that can be safely removed.
  • Understanding why the total SIZE of images is much higher than the actual unique disk footprint.
  • Finding dangling images from previous builds or pulls.
  • Prioritizing which images to remove to maximize actual disk space recovery based on UNIQUE SIZE rather than total SIZE.