Container image
Definition
A container image is a stack of read-only file system layers plus metadata (entry command, environment, ports), described by a manifest whose SHA-256 digest identifies exactly one set of contents.
In practice
An image freezes everything the app needs, so the same bytes run on a laptop, in CI and in production. Each build instruction that changes files produces a layer, and a layer is reused from cache only if it and every layer below it are unchanged. Ordering layers from least to most frequently changed (base OS, then dependencies, then code) keeps rebuilds and pulls small.
Tags such as latest or web:2.0 are movable names, so two environments can silently run different code under the same tag. Deploy by digest for reproducible releases and exact rollbacks. Large images slow every deploy and scale-out; smaller bases such as distroless cut pull time and vulnerabilities but make debugging harder.
Example
Copying package.json and running npm ci before copying the source means a code-only change rebuilds one 2 MB layer instead of the 180 MB dependency layer, and the deploy pins web@sha256:4f1c....