💼 Docker Interview Questions
Docker Interview Questions: 🎬 The Anatomy of a Strong Docker Scenario Answer The "just restart it" reflex The interviewer asks: "A container in production keeps restarting — wha
🎬 The Anatomy of a Strong Docker Scenario Answer
The "just restart it" reflex
The interviewer asks: "A container in production keeps restarting — what do you do?" In this film you will watch the difference between two answers to the same question: the reflex versus the structured one.
The weak reflex: "I would just docker restart it, that always works." Yes, it might work temporarily. But what the interviewer sees is a candidate who never asked about the ROOT CAUSE.
Layer 1 of the strong answer — EVIDENCE: "First I check the restart count with `docker ps -a`, the last output with `docker logs --tail 100`, and the RestartPolicy with `docker inspect`."
Layer 2 — command + RATIONALE: "If the logs show `OOMKilled`, I would raise the memory limit, but first I profile WHY it consumes that much memory — just raising the limit hides the symptom, not the disease."
Layer 3 — the ROOT cause: "The temporary fix is a restart; the permanent fix is finding the leak, fixing the Dockerfile or code, and pushing a new image — tagged with a commit SHA, not `:latest`."
Layer 4 — the Java bridge: "A container's restart loop is like a JVM crashing repeatedly after `OutOfMemoryError` — restarting treats the symptom, a heap dump/profiling finds the root cause."
Final — the formula: evidence commands → command + rationale → permanent root fix → Java analogy. Run your answer through these 4 layers for every interview question below; the candidate who thinks in order always beats the one who memorized commands.
Step by Step: Building a Docker Scenario Answer
Ask a clarifying question
Open by clarifying the environment: which restart policy, since when, what is in the logs? Asking is the first point.
List the evidence commands
Say "first I look with `docker ps -a`, `logs`, `inspect`" — knowing which command gives which information is how you separate yourself from rote memory.