What is a Docker image?
Answer
A Docker image is a read-only template used to create containers. It is a layered, immutable snapshot of a filesystem with all the dependencies, libraries, code, and settings needed to run an application. Images are built from a Dockerfile — a text file with instructions. Each instruction in the Dockerfile creates a new read-only layer in the image. Layers are cached and reused — if a layer hasn't changed, Docker uses the cached version, making builds fast. When you run an image, Docker adds a thin writable container layer on top. Image naming: repository:tag — e.g., nginx:1.25, node:20-alpine, ubuntu:22.04. Without a tag, :latest is assumed (but relying on latest in production is risky — pin specific versions). Images can be stored in registries: Docker Hub (public, default), Amazon ECR, Google GCR, GitHub Container Registry, or self-hosted. Commands: docker pull nginx:1.25 — download an image; docker images — list local images; docker rmi nginx:1.25 — remove an image; docker build -t myapp:1.0 . — build from Dockerfile.
Previous
What is a container?
Next
What is the difference between a container and a virtual machine?