What Is a Container Image? Understand Layers and Digests for Deployment
A container image is a deployable artifact that packages filesystem changes and default execution settings needed to start a container. To understand one, look beyond its tag: an image manifest points to configuration and filesystem layers, while a digest identifies particular content. A tag is a convenient human-readable name; a digest is a hash-based identifier for specific content.
What Is a Container Image? Understand Layers and Digests for Deployment
A container image is a deployable artifact that packages filesystem changes and default execution settings needed to start a container. To understand one, look beyond its tag: an image manifest points to configuration and filesystem layers, while a digest identifies particular content. A tag is a convenient human-readable name; a digest is a hash-based identifier for specific content.
What is an image made of?
The Open Container Initiative (OCI) Image Specification describes an image through a manifest, configuration, filesystem layers, and an optional image index. Each component has a different role.
**A layer** is a set of filesystem changes. Base files, a runtime, and application files can be stacked to form the final filesystem. For distribution compatibility, common image formats use tar-based layers.
**Configuration** can contain information needed to start a container, such as the command and arguments, environment variables, and working directory. An engine or runtime turns these settings into an execution configuration.
**A manifest** describes an image by referring to its configuration object and layers through descriptors. A descriptor includes details such as media type, size, and digest.
**An image index** can refer to multiple manifests. A common use is to connect variants for different CPU architectures or operating systems under one image name. A client selects the manifest that matches its target platform.
Reference by tag or digest
|
v
Image index (optional)
| |
v v
Platform A manifest Platform B manifest
config + layers config + layersThis is more than one compressed bundle of application files. Tools follow manifests and descriptors to retrieve the required content, then unpack layers in order to provide the filesystem used by a runtime. The OCI specification defines a common structure so that build, transfer, verification, and execution tools can understand images consistently.
How do layers affect builds and storage?
Build tools process recipes such as a Dockerfile to produce filesystem layers and configuration. When layers are separate, multiple images can refer to the same base layers, reducing duplicated storage and transfer. Build caches can also reuse the result of a step when its inputs have not changed. Layers do not automatically make an image small or safe: unnecessary files still have to be stored and transferred, and a secret added in one layer can remain there even if a later layer deletes it.
For example, separating compilation from the files needed at runtime can keep a compiler and temporary caches out of the final image. When reducing image size, do not focus only on the number of layers. Check that the final image still has the packages, certificates, dynamic libraries, and file permissions needed to run. The appropriate optimization depends on the build tool and application.
How are tags and digests different?
An image reference in a registry usually consists of a registry, repository, and tag. In registry.example/team/api:2.4, the registry stores the image, team/api identifies the repository and image, and 2.4 is the tag. Tags are convenient, but they can later be moved to point to another image. A tag such as :stable or :latest alone therefore does not guarantee that the deployed bytes will stay the same.
A digest is a content hash that addresses an image or one of its components. Docker supports pulling by image digest. Even if a tag is later moved to new content, a digest reference stays tied to the content identified by that digest. For example, these references serve different purposes:
registry.example/team/api:2.4
registry.example/team/api@sha256:<verified-digest>Tags make it easier to follow updates and understand release intent. Pinning a digest makes deployed content easier to reproduce and review explicitly, but it does not automatically pick up security updates. A deployment process can use a tag to discover a new build, then record its digest in the deployment declaration after verification. A digest does not prove who produced the image or that it is safe, so check signatures, provenance, and vulnerability findings separately.
How are images used in a deployment?
Consider this hypothetical example: a team builds an API service for both Linux and ARM-based environments.
CI builds the source and dependencies, produces image variants for both platforms, and creates an index that connects them.
The team publishes a candidate tag to a registry and checks the index or image digest returned by the registry.
Before deployment, the team verifies image provenance, signature policy, inspection results, and target platform.
The deployment configuration records the verified digest. A cluster node can select the index entry that matches its platform when it pulls the image.
When deploying a new build, reviewers check the digest change in code review. If something goes wrong, the team can roll back to a previously approved digest.
This is an explanatory example, not a report of a test in a particular CI system, registry, or cluster. Confirm that the registry and runtime support the relevant index, image media types, and authentication policy. When a digest changes, a person still needs to review whether the new image includes the intended vulnerability fixes and remains compatible with the application.
What should you check when choosing an image?
**Publisher and provenance:** Prefer images from official or otherwise verifiable projects, and inspect provenance information such as Dockerfiles, build records, and signatures.
**Reference stability:** Understand whether a tag can move. If reproducibility matters, record an approved digest in the deployment history.
**Platform:** Check that the index includes the required operating system and CPU architecture. An image built for only one platform may not run on nodes with another architecture.
**Layers and contents:** Look for unnecessary development tools, caches, and secrets. Do not assume that adding a later layer erases data in an earlier layer.
**Update process:** Pinning a digest stops automatic movement to newer content. You need a process for inspecting, approving, deploying, and rolling back new images.
An image is an important unit for reproducing an execution environment, but deployment reliability also depends on how references, builds, and verification are managed. Layers structure and enable reuse of content; a tag is a readable name; a digest identifies particular content. Knowing the difference helps you plan image-size improvements, multi-platform deployment, updates, and rollbacks more safely.
References
[Open Container Initiative: Image Format Specification](https://github.com/opencontainers/image-spec/blob/main/spec.md)
[OCI Image Manifest Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md)
[Docker Docs: Pull an image by digest](https://docs.docker.com/reference/cli/docker/image/pull/)
[Docker Docs: Multi-stage builds](https://docs.docker.com/build/building/multi-stage/)
[Docker Docs: Build cache](https://docs.docker.com/build/cache/)