All jobs / DevOps / SRE / cloud / Containers
DevOps / SRE / cloud interview question · 1–3 years
CI rebuilds a 12-minute Docker image on every commit. What do you change first?
The strongest answer
Order the Dockerfile so dependency layers stay cached, and cache those layers in CI — I do not start with a bigger runner
Why it works
Exactly. Cache-friendly layers, then CI cache. Hardware is later.
What a good answer covers
- Stable layers first in the Dockerfile.
- CI cache on those layers.
- Do not git the image.
- Do not skip to a bigger runner.
Answers that fall short
- Close, but not the strongest: Commit the built image to git
Images in git are a bad registry. - Weak: Disable BuildKit; the old builder was simpler
BuildKit is the 2026 default for a reason. - Red flag: Copy the image from a developer’s laptop into the registry
Laptop images are a supply-chain smell.
Who gets asked this
More Containers questions
- A production image is 1.8 GB and includes a compiler. What do you do?
- The app container connects to `localhost:5432` and gets connection refused, though the database container is…
- The Dockerfile has no USER line, so the app runs as root. Does that matter inside a container?
- The container registry has grown to terabytes, pulls from the cluster are slow, and a public registry started…
- What is the difference between an image and a container?
- A Dockerfile says `FROM node:latest`. What is wrong?
- A container can take all the memory on the node. What do you set?
- In the team’s Docker Compose stack, Postgres loses all its data every time the container is recreated. Why…