Interview's MateDocker
Interview's Mate

Docker

Compose · Networking · Security · Ops

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Docker topics
Lesson 56/ 160
03. Storage, Volumes & Data Persistence

Inspecting Storage Usage (docker system df)

Inspect image, container, and volume disk usage with docker system df.

Beginnersystem df · Usage3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Inventory before cleanup and trend the reclaimable space against deployment cadence.

Think of it like…

system df is the warehouse inventory sheet, not the destruction order; a large reclaimable number still needs an owner and retention decision.

Where you’ve seen it

In practice, docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v is the concrete move for this job: inspect image, container, and volume disk usage with docker system df. The release is not accepted until reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class confirms the result.

Words you’ll hear

system df
The implementation control in docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v for inspect image, container, and volume disk usage with docker system df.
Usage
The result to observe with reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class, rather than infer from a successful command alone.
Reclaim
The production boundary exposed when adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable.

Visual diagram

Loading interactive diagram

Theory & deep dive

system df control path

The concrete mechanism is docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v. The observable result is reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class; if those disagree, inspect the runtime evidence before changing unrelated settings.

Inspect image, container, and volume disk usage with docker system df. Keep system df, Usage and Reclaim in the same deployment record so the intent and the observed state cannot drift apart.

Concrete system df setup

docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v

Key takeaway: Prove Usage with reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class, not with command success alone.

Reclaim failure boundary

The headline total double-counts shared layer intuition and can mislead teams: local volume data may be the largest bucket but is excluded from ordinary prune. A dangling image can be safe to remove while an orphaned named volume is business data. The narrow failure to design for is adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable.

Accept this compromise explicitly: The summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why. The controlled check-reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class-also identifies the point where a different design is safer.

Deliberate failure test

Exercise this failure safely: adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable.

Key takeaway: The summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why.

How it works, step by step

Step 1 of 4
Design

1. State the boundary

Write down why the workload needs this: The headline total double-counts shared layer intuition and can mislead teams: local volume data may be the largest bucket but is excluded from ordinary prune. A dangling image can be safe to remove while an orphaned named volume is business data.

Inventory before cleanup and trend the reclaimable space against deployment cadence.
Key numbers at this step
Intent
system df

When to use it & trade-offs

What it is

docker system df summarizes space used and reclaimable by images, containers, local volumes and build cache. -v expands the table to identify individual objects, shared sizes and which stopped or dangling artifacts account for the totals.

Why it matters: The headline total double-counts shared layer intuition and can mislead teams: local volume data may be the largest bucket but is excluded from ordinary prune. A dangling image can be safe to remove while an orphaned named volume is business data.

When to reach for it

  • The fit is strongest for this job: inspect image, container, and volume disk usage with docker system df. Pair it with reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class in the runbook.
  • Production system df changes should make Usage observable through docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v, rather than trusting the runtime default.
  • Keep a rollback example for the case where adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable.

When to avoid or be careful

  • Do not accept command success while the system can still fail by adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable.
  • Avoid erasing Reclaim protection merely to dodge this cost: “The summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why”.
  • Do not replace the evidence path-reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class-with a screenshot or a mutable tag.

docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v: practical choices

Explicit system df
Best for: Inspect image, container, and volume disk usage with docker system df, with a reviewed runbook.

Strengths: docker system df summarizes space used and reclaimable by images, containers, local volumes and build cache. -v expands the table to identify individual objects, shared sizes and which stopped or dangling artifacts account for the totals.

Watch out: The summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why.

Ambient default
Best for: Short-lived Usage experiments with low blast radius.

Strengths: It can begin with docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v and fewer surrounding controls.

Watch out: It silently accepts adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable, which makes the result hard to reproduce after promotion.

Managed Reclaim
Best for: Teams that centralize Reclaim policy across many workloads.

Strengths: The headline total double-counts shared layer intuition and can mislead teams: local volume data may be the largest bucket but is excluded from ordinary prune. A dangling image can be safe to remove while an orphaned named volume is business data.

Watch out: The platform adds an ownership and debugging layer; retain reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class as the direct check.

Interview signals & numbers to know

When this topic comes up

  • docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v
  • reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class
  • Failure signature: adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable
  • Trade-off: The summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why.

Benchmarks & rules of thumb

4 object groups -
images, containers, volumes and build cache
2 size views -
unique/sharable and current/reclaimable summaries
1 pre-cleanup snapshot -
should be saved for change comparison

Common mistakes & follow-ups

Common interview mistakes

  • Treating a successful docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v as proof and skipping reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class.
  • Adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable
  • Optimizing system df without accepting that the summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why.

Likely interviewer follow-ups

  • Why does docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v address system df here rather than through application code?
  • How would you distinguish healthy Usage from the failure “adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable” using reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class?
  • When would this trade-off-“The summary is fast and scriptable; deeper filesystem and vendor-volume monitoring explains who is growing and why”-justify a different Reclaim design?
Interview tip: Give one concrete operation-docker system df --format "{{.Type}}\t{{.Size}}\t{{.Reclaimable}}" && docker system df -v-and one proof-reconcile the top image, container and build-cache rows with the retention policy before invoking any prune class. Then name the boundary: adding all Size values as if layers are not shared, or deleting the largest volume because it is marked reclaimable.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Inspecting Storage Usage (docker system df) with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Managing Disk Quotas & Volume Size Limits
Next topic
Cleaning Up Dangling & Orphaned Volumes