All jobs / DevOps / SRE / cloud / Containers
DevOps / SRE / cloud interview question · 0–1 years
What is the difference between an image and a container?
The strongest answer
An image is the immutable recipe; a container is a running instance of that recipe — I do not “SSH into the image to fix prod”
Why it works
Exactly. Recipe versus process. You ship images; you run containers.
What a good answer covers
- Image = immutable artifact.
- Container = running instance.
- Fix the image, do not pet the container.
- Do not call it a small VM and stop thinking.
Answers that fall short
- Close, but not the strongest: They are the same word; Docker uses both for marketing
The words are not interchangeable in an interview. - Weak: The container is what we store in the registry; the image is what crashes
Registries store images. - Red flag: An image is a VM; a container is a smaller VM
Containers share a kernel; they are not tiny VMs, even if they feel like one.
Who gets asked this
More Containers questions
- 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?
- 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…