Skip to content

Image

In one line

An image is a read-only, layered template that contains everything needed to run a containerized application.

In simple words

A Docker image is a read-only template that contains your application and everything it needs to run — code, libraries, environment variables, and configuration files. You run a container from an image.

Images are built from a Dockerfile and are composed of layers. Each instruction in the Dockerfile creates a new layer. Layers are cached and shared between images, which makes builds fast and images small.

Images are identified by a name and a tag (e.g., nginx:latest, myapp:1.2.3). The tag latest is the default but should be avoided in production — always use specific version tags so you know exactly what you are deploying.

Example

bash
# Build an image from a Dockerfile
docker build -t myapp:1.0 .

# List images on your machine
docker images

# Run a container from the image
docker run -p 80:80 myapp:1.0

Build an image tagged myapp:1.0 from the Dockerfile in the current directory, then run it as a container.

How it works

  1. You write a Dockerfile describing the image contents.
  2. docker build creates the image layer by layer from the Dockerfile.
  3. docker push stores the image in a registry.
  4. docker run creates a container (a running instance) from the image.

Common confusions

  • Confused with: Container

    The difference: An image is a static, read-only template; a container is a running instance of an image with its own filesystem and processes.

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary