Learning center

A tag was pushed again: which image digest is actually running?

Read the digest from the running container, task or pod, never from the tag. Pushing a tag again changes what the registry returns for that tag, but containers started before the push keep the old image, and on Kubernetes some later starts can too. Compare the digest that runs with the digest your tests ran on.

The tag and the container disagree#

This fixture runs a local registry, pushes app:1.4, starts a container from it, then builds and pushes app:1.4 again (Docker 29.1.3, registry:2):

## push app:1.4 (first build)
registry digest for app:1.4: sha256:255fbe6a39733c0b964e6d0943b8dd5bdbaa648f96454b1d405e7a091dc830ff
## push app:1.4 again (second build)
registry digest for app:1.4: sha256:6bb00d4ace8603ac9948bfc5a97d754ddb9eae01774ae35844e43cef48456687
$ docker inspect fx-app --format "{{.Config.Image}} {{.Image}}"
localhost:5055/app:1.4 sha256:255fbe6a39733c0b964e6d0943b8dd5bdbaa648f96454b1d405e7a091dc830ff
$ docker image inspect $(docker inspect fx-app --format "{{.Image}}") --format "{{json .RepoDigests}}"
[]
$ docker exec fx-app cat /version
first

.Config.Image repeats the name the container was started with, so it still says app:1.4 while the tag now means something else. .Image holds the image that runs, the first push. The old image has lost its repository digest locally, so RepoDigests is empty and nothing ties it to a name any more. docker inspect

The fixture used the containerd image store, the default for fresh Docker Engine 29 installs, where the image ID equals the manifest digest the registry reported. A daemon upgraded from an earlier version may still use the legacy store, where the image ID is not the registry digest. containerd image store

Read the digest where the workload runs#

PlatformCommandField
Dockerdocker inspect CONTAINER --format '{{.Image}}'Image ID; the manifest digest on the containerd store
Kuberneteskubectl get pod POD -o jsonpath='{range .status.containerStatuses[*]}{.name}{"\t"}{.imageID}{"\n"}{end}'imageID, resolved by the runtime
Amazon ECSaws ecs describe-tasks --cluster CLUSTER --tasks TASK --query 'tasks[].containers[].{name:name,digest:imageDigest}'imageDigest, "The container image manifest digest"
Cloud RunRevision status.imageDigestSee comparing revisions

Kubernetes documents that imageID "may not match the image ID of the image used in the PodSpec, as it may have been resolved by the runtime". ContainerStatus · ECS Container

Read every pod, not one. A tag other than :latest gets the IfNotPresent pull policy by default, which skips the pull "if it already exists" on the node. A node that cached the first push starts new pods on it, while a fresh node pulls the second. Image pull policy On ECS, a deployment resolves the tag once when it starts. The ECR lifecycle guide shows where that resolved digest is recorded.

Compare it with the tested digest#

Equal digests mean the running bytes are the tested bytes. A different digest has two common causes besides a second push. A multi-platform image has an index digest and one manifest digest per platform, and a runtime may report either one. docker buildx imagetools inspect IMAGE@INDEX_DIGEST lists the platform manifests, so you can check whether the running digest is one of them. imagetools inspect A release job that rebuilt the image also produces a new digest, and promoting the tested artifact covers that case.

To stop the question recurring, deploy by digest. Kubernetes notes that a digest makes the workload run "the same code no matter what tag changes happen at the registry". Image pull policy

Worked example#

This example is fictional. Ben's hotfix was pushed as app:1.4 over the existing tag, and the incident did not stop. The Kubernetes imageID values show two digests across six pods: the four pods on older nodes still run the first 1.4. The fix never reached them, so the error rate those pods produced says nothing about the fix. Ben redeploys with app@sha256:… and checks that all six pods report the same digest.

For a tag that moved under a build, read base image tag moved between builds.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading