Skip to main content

Image Digest

An image digest is a SHA256 hash of an image manifest that identifies exact image content. Unlike a tag, which can be moved, a digest always refers to the same bytes.

Tags move, digests do not

A tag such as nginx:1.27 is a label that a publisher can re-point to different content. A digest like nginx@sha256:<hash> is computed from the manifest, so any change to the image produces a different digest. Pulling by digest guarantees you run exactly what you tested.

Bash
docker images --digests nginx
docker pull nginx:1.27
docker inspect nginx:1.27 --format '{{index .RepoDigests 0}}'
docker pull nginx@sha256:<digest>

Pin a base image

Dockerfile
# Tag plus digest: readable, and the digest is what Docker enforces
FROM node:20.18.0-alpine3.20@sha256:<digest>

Automate updates

JSON
{
"extends": ["config:recommended", "docker:pinDigests"]
}

Renovate opens pull requests when a pinned base image changes, so updates are reviewed and tested rather than arriving silently. Dependabot offers similar Docker updates.

Use in deployments

Kubernetes and security-sensitive pipelines should reference images by digest, or resolve tags to digests at build time and store the digest in manifests.

Remember

A multi-platform image has a digest for the manifest list and different digests per architecture. Pinning the list digest keeps all platforms consistent.

Tip

Digests are unreadable in diffs, so keep a human-readable tag next to the digest.

Frequently Asked Questions

How is a digest different from a tag?

A tag is a movable pointer that can later reference different content. A digest is derived from the image manifest, so it identifies one exact set of layers and config. Pulling by digest gives reproducible results.

Why not use digests everywhere?

They are hard to read and review, and pinned images stop receiving updates automatically. Pair digests with Renovate or Dependabot so updates arrive as reviewable pull requests.

Is an image ID the same as a digest?

No. The image ID identifies the local image configuration, while the digest identifies the manifest in a registry and is the stable reference across machines.

Found a mistake, an outdated step or a broken link?