⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 998+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
Senior DevOps / SRE [L2] Docker Must enable BuildKit Production Scenario [L2]

Q: A container running Nginx generates enormous log files and eventually fills the disk on the Docker host. You want Docker to automatically handle log rotation without modifying the Nginx configuration. How?

Docker's default json-file logging driver stores container stdout/stderr as JSON files under /var/lib/docker/containers/<id>/. Without li...

#Docker #Must enable BuildKit #L2 #Containers #Linux
🎙️ Candidate Opening & Architectural Context
""In an interview, I explain how we diagnosed container runtime failures without guessing. The interviewer is testing: Docker logging driver configuration, log rotation.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement

🛠️ Production Runbook & Step-by-Step Resolution

1️⃣

Production Solution & Architecture

Docker's default json-file logging driver stores container stdout/stderr as JSON files under /var/lib/docker/containers//. Without limits, these files grow unbounded. Configure log rotation at the container level: Or set it globally in /etc/docker/daemon.json: This rotates logs at 50MB per file and keeps a maximum of 5 rotated files (250MB total per container). For Docker Compose, use the logging: key under each service. Note: changing the global config only affects *newly created* containers, not existing ones.

docker run --log-opt max-size=50m --log-opt max-file=5 nginx
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Docker's default json-file logging driver stores container stdout/stderr as JSON files under /var/lib/docker/containers//. Without."
⚡ 60-Second Elevator Pitch Talking Points
  • Immediate Triage: Docker's default json-file logging driver stores container stdout/stderr as JSON files under /v
  • Run targeted verification commands before modifying configuration.
  • Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement
Want more Docker scenarios?
Explore our complete collection of scenario-based Docker interview runbooks.
Browse All Docker Questions →

📚 Related Production Scenarios in Docker