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
# 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.0Build an image tagged myapp:1.0 from the Dockerfile in the current directory, then run it as a container.
How it works
- You write a Dockerfile describing the image contents.
docker buildcreates the image layer by layer from the Dockerfile.docker pushstores the image in a registry.docker runcreates 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.