All jobs / DevOps / SRE / cloud / Containers
DevOps / SRE / cloud interview question · 1–3 years
A production image is 1.8 GB and includes a compiler. What do you do?
The strongest answer
Multi-stage: build in one stage, copy the runtime bits into a slim image — I do not ship the toolchain to prod
Why it works
Exactly. Slim runtime. A compiler in prod is attack surface and minutes on every pull.
What a good answer covers
- Multi-stage builds.
- Runtime-only final image.
- No compiler in prod.
- Smaller pull, smaller surface.
Answers that fall short
- Close, but not the strongest: Leave it; bigger images start faster
Bigger is slower to pull, not faster to start. - Weak: Compress the compiler with gzip inside the image
gzip of a compiler is still a compiler. - Red flag: Run prod as the build stage so we can hotfix compile on the node
A compiler on the node is a pet.
Who gets asked this
More Containers questions
- 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…
- CI rebuilds a 12-minute Docker image on every commit. What do you change first?