Docker scenario interview questions
Docker questions go past what a container is. Interviewers ask why an image is several gigabytes, why every build reinstalls dependencies, or whether mounting the Docker socket into a CI container is fine. Each one has a cost, speed or security trade-off behind it.
Each question below is the exact prompt from a DevOps Ledger challenge. Decide what you would do, then open the challenge to defend it.
3 scenarios: 2 beginner, 1 intermediate, 0 advanced. Answer keys reviewed by Branko Petric.
What interviewers probe
- Layer order and build cache
- Multi-stage builds and what ends up in the final image
- What the Docker socket and --privileged actually grant
The questions
- 01beginner8 min
1.6GB Docker Image, 8-Minute Builds. Add Runners?
Your Node app's Docker image is 1.6GB and every code change rebuilds dependencies from scratch, so CI takes 8 minutes. A teammate says just add more CI runners. How do you fix the image, and why?
Practice this scenario - 02beginner9 min
The Build Is Slow, So Let's Just Add --no-cache to CI?
Docker builds in CI are taking 11 minutes and sometimes ship stale dependencies. A teammate says just add --no-cache to every build so we always get a clean image and stop debugging cache weirdness. What do you do, and why?
Practice this scenario - 03intermediate12 min
The Container Needs Docker, So Mount the Socket and Run --privileged?
A CI job inside a container needs to build images, and a teammate says just bind-mount /var/run/docker.sock and run the job with --privileged so it can do whatever it needs. What do you do, and why?
Practice this scenario
Worked answers
- Scenario Based DevOps Interview Questions, With Worked Answers
Scenario based DevOps interview questions for Linux, Docker, CI/CD, Git and AWS, with first commands, the interviewer's pushback, and weak vs strong answers.
Free Docker guides
Practice defending your decisions
DevOps Ledger is a scenario-based DevOps and SRE interview practice platform: you pick a real production incident, defend your decision in a chat against a senior-engineer AI that pushes back, and get scored against an answer key written before you started.
A general chatbot makes up an answer on the spot. DevOps Ledger grades you against an answer key written before you started.
One payment. 12 months of access. No subscription, nothing renews.
Get full access - $19