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 55/ 160
03. Storage, Volumes & Data Persistence

Managing Disk Quotas & Volume Size Limits

Apply quotas and size limits so one volume cannot exhaust the host disk.

AdvancedQuotas · Size Limits3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Define both the physical ceiling and the operational alert threshold for stateful data, not merely a quota flag in a compose file.

Think of it like…

A nominal room limit means little if all tenants share one water tank; the shared tank needs a low-water alarm and each outlet may need its own meter.

Where you’ve seen it

In practice, df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data is the concrete move for this job: apply quotas and size limits so one volume cannot exhaust the host disk. The release is not accepted until fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use confirms the result.

Words you’ll hear

Quotas
The implementation control in df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data for apply quotas and size limits so one volume cannot exhaust the host disk.
Size Limits
The result to observe with fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use, rather than infer from a successful command alone.
Disk Pressure
The production boundary exposed when believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure.

Visual diagram

Loading interactive diagram

Theory & deep dive

Quotas control path

The concrete mechanism is df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data. The observable result is fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use; if those disagree, inspect the runtime evidence before changing unrelated settings.

Apply quotas and size limits so one volume cannot exhaust the host disk. Keep Quotas, Size Limits and Disk Pressure in the same deployment record so the intent and the observed state cannot drift apart.

Concrete Quotas setup

df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data

Key takeaway: Prove Size Limits with fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use, not with command success alone.

Disk Pressure failure boundary

A full data volume can stall databases, write incomplete checkpoints and fill the shared Docker host. A quota at the VM disk can still allow one local volume to starve every image layer on the same filesystem. The narrow failure to design for is believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure.

Accept this compromise explicitly: Per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost. The controlled check-fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use-also identifies the point where a different design is safer.

Deliberate failure test

Exercise this failure safely: believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure.

Key takeaway: Per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost.

How it works, step by step

Step 1 of 4
Design

1. State the boundary

Write down why the workload needs this: A full data volume can stall databases, write incomplete checkpoints and fill the shared Docker host. A quota at the VM disk can still allow one local volume to starve every image layer on the same filesystem.

Define both the physical ceiling and the operational alert threshold for stateful data, not merely a quota flag in a compose file.
Key numbers at this step
Intent
Quotas

When to use it & trade-offs

What it is

Docker does not impose a universal logical size limit on local volumes. Enforce capacity at the filesystem, LVM/ZFS/Btrfs, cloud block-device, storage-driver or application layer, and alert before the host filesystem reaches its hard limit.

Why it matters: A full data volume can stall databases, write incomplete checkpoints and fill the shared Docker host. A quota at the VM disk can still allow one local volume to starve every image layer on the same filesystem.

When to reach for it

  • The fit is strongest for this job: apply quotas and size limits so one volume cannot exhaust the host disk. Pair it with fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use in the runbook.
  • Production Quotas changes should make Size Limits observable through df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data, rather than trusting the runtime default.
  • Keep a rollback example for the case where believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure.

When to avoid or be careful

  • Do not accept command success while the system can still fail by believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure.
  • Avoid erasing Disk Pressure protection merely to dodge this cost: “Per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost”.
  • Do not replace the evidence path-fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use-with a screenshot or a mutable tag.

df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data: practical choices

Explicit Quotas
Best for: Apply quotas and size limits so one volume cannot exhaust the host disk, with a reviewed runbook.

Strengths: Docker does not impose a universal logical size limit on local volumes. Enforce capacity at the filesystem, LVM/ZFS/Btrfs, cloud block-device, storage-driver or application layer, and alert before the host filesystem reaches its hard limit.

Watch out: Per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost.

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

Strengths: It can begin with df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data and fewer surrounding controls.

Watch out: It silently accepts believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure, which makes the result hard to reproduce after promotion.

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

Strengths: A full data volume can stall databases, write incomplete checkpoints and fill the shared Docker host. A quota at the VM disk can still allow one local volume to starve every image layer on the same filesystem.

Watch out: The platform adds an ownership and debugging layer; retain fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use as the direct check.

Interview signals & numbers to know

When this topic comes up

  • df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data
  • fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use
  • Failure signature: believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure
  • Trade-off: Per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost.

Benchmarks & rules of thumb

90% -
common alert threshold, before hard full
100% blocks and 100% inodes -
both can independently produce ENOSPC behavior
1 underlying filesystem -
many local volumes may compete on the same disk

Common mistakes & follow-ups

Common interview mistakes

  • Treating a successful df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data as proof and skipping fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use.
  • Believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure
  • Optimizing Quotas without accepting that per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost.

Likely interviewer follow-ups

  • Why does df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data address Quotas here rather than through application code?
  • How would you distinguish healthy Size Limits from the failure “believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure” using fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use?
  • When would this trade-off-“Per-volume quotas limit blast radius; separate filesystems/VM disks give stronger isolation at higher provisioning cost”-justify a different Disk Pressure design?
Interview tip: Give one concrete operation-df -h /var/lib/docker; findmnt -T /var/lib/docker/volumes; xfs_quota -x -c report /srv/docker-data-and one proof-fill only a dedicated test quota, observe ENOSPC behavior, and confirm Prometheus or host alerts fire before 90% use. Then name the boundary: believing --storage-opt size= affects every storage driver, or watching percentage used while inode exhaustion is the real failure.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Managing Disk Quotas & Volume Size Limits with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
File Permissions & UID/GID Mismatches in Mounted Volumes
Next topic
Inspecting Storage Usage (docker system df)