Learning center

Same Dockerfile, same commit, different image: the base tag moved

A Dockerfile line such as FROM node:22 names a tag, and the publisher can move that tag to a new image at any time. Two builds of the same commit a week apart can start from different base images, and nothing in the repository records which one each build used. Record the base image digest each build resolved, and pin @sha256: in the Dockerfile when you need the next build to match the one you tested.

A tag is a pointer the publisher moves#

Docker's build best practices say "Image tags are mutable, meaning a publisher can update a tag to point to a new image", and that a digest pin keeps "the same image version, even if a publisher replaces the tag with a new image." Pin base image versions

When a tag such as node:22 moves, the source code, the lockfile and the Dockerfile stay the same, so a diff between two release commits shows nothing.

Fixture: what node:22 meant on 2 December 2026#

Run at 07:42 UTC with Docker 29.1.3 and buildx v0.39.1:

$ docker buildx imagetools inspect node:22 | head -3
Name:      docker.io/library/node:22
MediaType: application/vnd.oci.image.index.v1+json
Digest:    sha256:7c400d78797d8cbe3f6bb21d2227b86af4cd24b0014cc9f62ff989cc16de988e
$ docker pull -q node:22 >/dev/null
$ docker image inspect node:22 --format '{{.RepoDigests}}'
[node@sha256:7c400d78797d8cbe3f6bb21d2227b86af4cd24b0014cc9f62ff989cc16de988e]
$ docker image inspect node:22 --format '{{range .Config.Env}}{{println .}}{{end}}' | grep NODE_VERSION
NODE_VERSION=22.23.5

node:22 is an image index: one digest for the list, and one per platform inside it. In the JSON from docker buildx imagetools inspect node:22 --format "{{json .Manifest}}", the linux/amd64 entry was sha256:81ad3f93f122008a146891525948c689cfd8e9ff9f8cb8445cc95991d7a0251c. The pulled image's RepoDigests holds the index digest, and the image Docker pulled for this host's platform sets NODE_VERSION=22.23.5. Docker Hub's tag API (https://hub.docker.com/v2/repositories/library/node/tags/22) gave last_updated as 2026-11-24T20:38:14Z, eight days before the run, with the same index digest. A build from before that date may have started from another image, and only that build's own record can say which. docker buildx imagetools inspect

Record the digest the build used#

BuildKit prints the resolved digest in its plain progress log. A build of FROM alpine:3.22 in a related fixture logged:

#4 [1/2] FROM docker.io/library/alpine:3.22@sha256:49340b346798875b5592e5d420241f2f9cfba5f47e62ebb1446a1b34734e898f

Keep that line with the release, or write it into the image as a label. To make the next build match the tested one, pin the digest from the tested build's record, not from a fresh lookup of the tag, which may have moved since:

FROM node:22@sha256:DIGEST_FROM_THE_TESTED_BUILD_LOG

For a multi-platform tag, pin the index digest, so each platform still gets its own image. When you compare two builds, compare the platform entry they ran as well; a single-platform image has no entries, and its one digest is the image: a publisher can republish an index with a new digest while the linux/amd64 image inside it stays the same. A pin stops security updates as well as surprises, so let a tool propose the bumps: the same best-practices page notes that Dependabot raises pull requests to update base image tags and digests. Each bump then goes through review and CI like any other dependency change.

Two images differ: is it the base?#

ObservationWhat it showsNext record to read
The FROM digests differThe tag pointed at different indexesThe platform entries inside both; if they match, the base image did not change
Same FROM digest, every RUN step DONEThe steps ran again, so their downloads may differThe versions each step downloaded or installed
Same FROM digest, some steps CACHEDThose layers may be older than either buildA cached layer that kept an old download
No FROM line was keptNot which base the build usedThe image's build provenance materials, if the build attached them; the registry shows only today's mapping

A moved base explains a different image only when the FROM digests differ. Unpinned package installs and downloads in RUN steps change images too, and they can change in the same week as the base.

For the image your service runs, the same question applies to your own tags: see the running image digest after a tag was overwritten.

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