What is a Docker image?
A Docker image is an immutable filesystem template from which Docker starts a container. The image contains everything the application needs to run: dependencies, system libraries, configuration, binaries, environment variables, and startup instructions.
Key properties of a Docker image
- Immutable - an image cannot be changed after it is built; any changes happen by creating a new layer.
- Layered structure - an image consists of layers (each
Dockerfileinstruction creates a new layer). This saves space and speeds up builds. - Reusable - one image can be used to run many containers.
- Portable - an image can be transferred and run on any machine that has Docker.
Relation to a container
- Image = template (like an ISO image or snapshot)
- Container = a running instance of an image
Where images are stored
- locally on the machine;
- in a registry (for example, Docker Hub, GitLab registry, ECR, etc.).
In one phrase: a Docker image is a reusable, layered template that lets an application run reproducibly in a container.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.