⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ 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) →
← Back to All Docker & Containers Interview Questions Scenario 63 of 159 in Docker & Containers
Junior / Associate DevOps [L1] Docker Core Fundamentals [L1]
🎯 Target Role / Context: Docker Scenario #63 (L1) · Docker

Q: A container exits with code `137`. What does this specific code universally mean in the Docker ecosystem, and where should you look next?

Exit code 137 specifically means the container received a SIGKILL (signal 9) and was abruptly terminated ($128 + 9 = 137$).

#Docker #L1 #Containers #Linux #Terraform State
🎙️ Candidate Opening & Architectural Context
""During an image optimization initiative across our services, we solved this exact problem. The interviewer is testing: Exit code evaluation, OOM killer.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's Docker Certified Associate (DCA) Hands-On Lab Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: "During an image optimization initiative across our services, we solved this exact problem. The interviewer is testing: Exit code evaluation, OOM killer.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."

1️⃣

Production Solution & Architecture

Exit code 137 means the container's main process received SIGKILL (signal 9) and was terminated immediately (128 + 9 = 137). The most common sender is the kernel OOM (Out Of Memory) Killer, which fires when the container exceeds its memory limit. A docker kill, a docker stop that outlived its grace period, or an orchestrator force-stop produce the same code. Next steps: run docker inspect and check the State.OOMKilled flag to tell them apart.

docker inspect --format '{{.State.OOMKilled}} {{.State.ExitCode}}' <container_id>
dmesg -T | grep -i -E 'oom|killed process'
  • OOMKilled is true: The container hit its memory limit. Profile the application and review the -m limit; check dmesg -T | grep -i oom on the host.
  • OOMKilled is false: Look for a forced stop. docker stop sends SIGTERM, then SIGKILL after 10 seconds, so an app that ignores SIGTERM exits with 137.
  • Host memory pressure: The host can run out of memory and kill a container that was under its own limit. Check host memory and the limits of its neighbours.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Exit code 137 means SIGKILL (128 + 9). Check State.OOMKilled and the host's dmesg first. If OOMKilled is false, look at docker stop timeouts, manual kills and host memory pressure instead of raising the memory limit."
⚡ 60-Second Elevator Pitch Talking Points
  • Immediate triage: exit code 137 means the container received SIGKILL (128 + 9); confirm with State.OOMKilled.
  • Run targeted verification commands before modifying configuration.
  • Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Assuming every exit code 137 is an out-of-memory kill A forced docker kill or a docker stop that outlived its 10 second grace period also exits 137. Check State.OOMKilled before changing limits.
  2. Raising the memory limit before profiling the application A leak survives a bigger limit and only fails later. Use docker stats and application profiling to find what is growing.
  3. Running the app under a shell wrapper or npm start as PID 1 that does not forward SIGTERM docker stop waits 10 seconds and then sends SIGKILL, so every restart ends in 137. Use exec form, exec, or docker run --init.
  4. Forgetting that tmpfs mounts and page cache count toward the container's memory Heavy writes to a tmpfs or /dev/shm can trigger an OOM kill even when the application heap looks small.
Advertisement
Want more Docker & Containers scenarios?
Explore our complete collection of scenario-based Docker & Containers interview runbooks.
Browse All Docker & Containers Questions →