Skip to main content

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

  1. Immutable - an image cannot be changed after it is built; any changes happen by creating a new layer.
  2. Layered structure - an image consists of layers (each Dockerfile instruction creates a new layer). This saves space and speeds up builds.
  3. Reusable - one image can be used to run many containers.
  4. 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.