Interview Prep/Docker/Volumes, storage and data

How would you limit how much disk a container can write?

AdvancedScenarioVolumes, storage and data
Answer

Situation read → One runaway container fills the host disk.

What I'd do →

  1. docker run --storage-opt size=10G works on overlay2 only with an XFS backing filesystem mounted with pquota.
  2. Alternatively put /var/lib/docker on its own filesystem or LV so it cannot starve the root disk.
  3. Use --tmpfs size= for scratch space and log rotation for logs.
  4. In Kubernetes use ephemeral-storage limits.

Why → Docker has no portable per-container disk quota on ext4.

Interview tip → Monitor docker system df -v and node disk pressure.

All Docker questions Roadmap: Docker & containers

More on Volumes, storage and data