Topic 8.4
The Docker Interview: What You'll Actually Be Asked
In one line
A curated set of the questions that come up again and again in real interviews, each one directly answerable from this course — treat this as your final self-check.
Key ideas
- 01
Fundamentals tier (expect these in almost every interview): image vs container, the container lifecycle states, why Docker is lighter than a VM, what a Dockerfile instruction like RUN/CMD/COPY actually does, and the client-daemon-registry architecture.
- 02
Practical tier (mid-level and up): why layer caching matters and how to order a Dockerfile for it, named volumes vs bind mounts and when to use each, the difference between EXPOSE and
-p, and how container-to-container DNS resolution actually works. - 03
Production-readiness tier (senior level): multi-stage builds and why they matter for compiled languages, container security basics (non-root users, image scanning, secrets handling), resource limits and why the JVM specifically needs container-aware memory settings, and healthchecks vs plain 'is the process running.'
- 04
Systems-thinking tier (the questions that separate a senior candidate): 'when would you NOT use Docker', 'what's the difference between Docker and Kubernetes, precisely', 'walk me through what happens end-to-end when I run
docker run nginxon a machine that's never seen that image before', and 'how would you debug a container that's using way more memory than expected.' - 05
The meta-skill interviewers are actually testing across ALL of these: can you explain not just WHAT a command does, but WHY Docker is designed that way, and what PROBLEM that design choice solves — exactly the 'real-life analogy first, then mechanism, then trade-off' structure this entire course has used for every single topic.
- 06
A genuinely strong closing answer to almost any 'why Docker' question ties back to this course's very first lesson (Phase 0.1): Docker exists to make 'it works on my machine' a solved problem, by packaging an application with its full runtime environment into one portable, reproducible unit.
In your stack
- →
A Java-specific interview favorite worth having a crisp answer for: 'what's different about containerizing a Java app compared to, say, a Node.js or Python app?' — a strong answer covers the JVM's memory-sizing history (Phase 6.2), the value of multi-stage builds for compiled artifacts (Phase 6.1), and Spring Boot's own built-in Docker tooling (Phase 6.3).
Code & diagrams
Try to answer every one of these OUT LOUD, without looking anything up, before checking this course's relevant topic.
FUNDAMENTALS
- What's the difference between an image and a container?
- Name the 5 states in a container's lifecycle and the command for each transition.
- Why is a container faster to start than a VM?
- What does EXPOSE actually do — and NOT do?
PRACTICAL
- Why does Dockerfile instruction ORDER affect build speed?
- When would you use a bind mount instead of a named volume?
- Why can't two containers on the DEFAULT bridge network resolve each other by name?
- What's the difference between docker stop and docker kill?
PRODUCTION-READINESS
- Why does a multi-stage build matter specifically for a compiled language like Java?
- Name three concrete container security habits and the specific risk each one addresses.
- Why might a JVM in an old container get OOM-killed even with a modest -Xmx?
- What's the difference between a container being "started" and being "healthy"?
SYSTEMS THINKING
- Precisely, what does Kubernetes add that Docker Compose cannot provide?
- Walk through, step by step, what happens when you run "docker run nginx" for the first time ever on a machine.
- When would you deliberately choose NOT to use Docker for something?Explain it without notes
Pick any 3 questions from the self-test above and answer them out loud, from memory, without notes — which one, if any, made you hesitate?
What is the common THREAD connecting almost every 'production-readiness tier' question in this topic?
Practice
Time yourself: answer all four tiers of questions in this topic's self-test, out loud, in under 15 minutes total — note which tier took the longest.
Write your own one-paragraph answer to 'why does Docker exist' (Phase 0.1) as if you were saying it in an actual interview right now — compare it against your very first attempt back in Phase 0.1's practice exercise.
Trade-offs
- ↔
Interview prep that only memorizes ANSWERS without understanding the underlying WHY breaks the moment a question is phrased slightly differently than expected — every topic in this course was written specifically to build the underlying mental model first, so you can derive a correct answer to a NEW phrasing of a familiar question, not just recite one you've seen before.
Done when you can
I can answer every fundamentals-tier question from this topic without hesitation.
I can answer at least 80% of the practical and production-readiness tier questions confidently.
I can give a precise, non-hand-wavy answer to the Docker vs Kubernetes question.
I've compared my current 'why Docker' answer against my very first attempt back in Phase 0.1.