Docker Hub Immutable Tags: The Image That Shipped Before It Was Signed
By Vladimir Mikhalev Docker Captain · CNCF Ambassador · IBM Champion
Release 2.2 was on Docker Hub under all three of its version tags, the full number, the minor and the major, at four minutes past three in the afternoon, UTC, on 26 September. The run that pushed them died in the same minute, refused by Docker Hub’s immutable tags, before cosign signed anything, before the build attestation, before the Trivy scan. Anyone who pulled that release got the image. Nobody who pulled it could verify it, and nobody ever will, because the tag that names the kubectl version inside it is immutable too and now points at that unsigned build for good. The workflow that did it was mine, and so was the immutability rule that stopped it.
Docker Hub immutable tags do exactly what they say. The failure is what a publish workflow assumes about the commit it is building, and that assumption is the same one in every pipeline built on Docker’s build-and-push action that I have reviewed: a tag run builds a commit nobody has built. It belongs with the supply-chain hardening I did for these images in April, as the part that hardening had not reached. Five weeks later the same order published an unsigned image again, with no tag collision at all, which is why the fix that matters here is not about tags.
What an immutable tags refusal looks like
The image is published from one workflow on four triggers: a push to main, a tag, a weekly schedule and a manual dispatch. Its tag rules were written so that every trigger got the tags it should:
# publish.yml in aws-kubectl-docker at v2.2.0, before:# every trigger emits a per-commit tag, including the release tagtags: | type=raw,value=latest,enable={{is_default_branch}} type=raw,value=edge,enable={{is_default_branch}} type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha,prefix=sha-,format=short,enable=${{ github.event_name == 'push' || github.event_name == 'pull_request' }} type=raw,value=kube-${{ steps.kube.outputs.version }},enable=${{ startsWith(github.ref, 'refs/tags/') }}A tag push is a push. The release commit had been published from main minutes earlier, with the per-commit tag pointing at that build. Then the tag run rebuilt the same commit, produced a new digest, and asked Docker Hub to move that per-commit tag to it. Docker Hub’s answer, from the run’s log with the masked account name filled in:
ERROR: failed to push heyvaldemar/aws-kubectl:sha-83be903: denied: requested access to the resource is denied - tag sha-83be903 is already assigned to an image in this repository and cannot be updated due to immutability settings. To push this image, use a different tagThe refusal was correct. The repository’s immutability rule covers version numbers, per-commit tags and the kubectl tags, and it is there on purpose, so that a version, a commit and a kubectl build can never be moved once published. Order is the problem. BuildKit pushes the manifest under each tag in turn, and the log shows the full version, then the minor, then the major going out; the version tag with its v prefix and the kubectl tag landed as well, and the push of the per-commit tag was refused. Five tags out, one refusal, one failed step, and every step after it skipped: the signature, the attestation, the scan.
The first fix emitted the per-commit tag from branch runs only, and the kubectl tag only when Docker Hub did not already hold it:
# .github/workflows/publish.yml in aws-kubectl-docker at v2.2.1, after:# a release tag emits only tags nobody holds yet- name: Is this kubectl version's tag still free? # kube-<version> is immutable on Docker Hub: it names the first image # that shipped this kubectl and can never be moved. A release that keeps # the same kubectl must leave it where it is, or the push is refused # after the version tags are already out and nothing gets signed. id: kubetag env: KUBE_VERSION: ${{ steps.kube.outputs.version }} run: | set -euo pipefail code="$(curl -s -o /dev/null -w '%{http_code}' "https://hub.docker.com/v2/repositories/${IMAGE_NAME}/tags/kube-${KUBE_VERSION}")" case "$code" in 200) echo "free=false" >> "$GITHUB_OUTPUT"; echo "kube-${KUBE_VERSION} already names an image; it stays where it is" ;; 404) echo "free=true" >> "$GITHUB_OUTPUT"; echo "kube-${KUBE_VERSION} is free" ;; *) echo "::error::Docker Hub answered $code for kube-${KUBE_VERSION}; cannot tell whether the tag is free"; exit 1 ;; esac# publish.yml in aws-kubectl-docker at v2.2.1, the first fix:# the two immutable tags a release must not try to move type=sha,prefix=sha-,format=short,enable=${{ github.ref_type == 'branch' }} type=raw,value=kube-${{ steps.kube.outputs.version }},enable=${{ startsWith(github.ref, 'refs/tags/') && steps.kubetag.outputs.free == 'true' }}That fix had the same defect one level down. A weekly schedule and a manual dispatch are branch runs too, and each rebuilds a commit main has already published, so the next scheduled run would have pushed latest and edge, been refused on the per-commit tag, and skipped the signature again, on the tags most people pull. The fact check for this post found it on 28 September, hours before that run, and the per-commit tag now gets the question the kubectl tag already got: does Docker Hub hold it.
# publish.yml in aws-kubectl-docker at 88f868e, the second fix (28 September):# both immutable tags are emitted only while Docker Hub does not hold them type=sha,prefix=sha-,format=short,enable=${{ github.ref_type == 'branch' && steps.shatag.outputs.free == 'true' }} type=raw,value=kube-${{ steps.kube.outputs.version }},enable=${{ startsWith(github.ref, 'refs/tags/') && steps.kubetag.outputs.free == 'true' }}Since release 2.3 on 26 October the image is built once for each of the three newest kubectl minors, and both rules carry one more condition in front: only the newest line emits them.
The patch release went out twenty-six minutes later, from the same Dockerfile, signed and scanned.
Why this keeps happening
Immutability is enforced at the registry and reasoned about in the workflow, and the workflow reasons in terms of triggers. Docker’s documentation describes immutable tags as tags that cannot be overwritten or deleted once pushed, with the rule expressed as a regular expression. Nothing in that sentence is about tag runs, branch runs or the order BuildKit pushes in. The workflow author has to know that a release tag usually lands on a commit that main has already published, and that a rebuild of the same commit is a different digest whenever a base layer, a package index or a timestamp moved.
The second reason is that the tag list is generated. Docker’s metadata action turns one list of rules into the right tags for whichever event fired, which is exactly the convenience that hides the collision. The per-commit rule is enabled on push, a tag push is a push, and the rule that was meant for branches fired for the release. A rule is a claim about every event that can trigger it, not about the one the author had in mind.
The third reason is that the failure is late and partial. A push step that refuses at the first tag is a clean failure: nothing is out, fix and rerun. A push step that refuses at the sixth tag has published five, and the steps that would have made those five trustworthy never ran. The image was in every sense released, and in the only sense that matters for verification it was not.
Immutability did its job. The workflow assumed a tag run builds a commit nobody has built.
Risk and blast radius
Direct exposure is verification. The image’s README tells a reader to verify a release with cosign before running it, under the workflow’s own keyless identity. For that release, cosign verify finds no signature, and there is no GitHub build attestation either. BuildKit’s own SLSA provenance is attached to the image, unsigned, so it describes a build without proving who ran it. A consumer with a policy that requires a signature, an admission controller or a cosign verify in their own pipeline, refuses the image. A consumer without one runs an image that was built by the right workflow and cannot prove it.
The permanent part is the kubectl tag, the one named for the kubectl version inside the image. That tag names the first image that shipped that kubectl version, and the rule makes it immutable on purpose, so it cannot be moved to the signed patch release either. The tag will point at the unsigned build for as long as the repository exists. The unsigned release’s page now says so in its first line and points at the patch, and since release 2.3 the README lists those three tags as unsigned and sends readers to the patch.
Systemic exposure is any pipeline that pushes several tags in one step under an immutability rule. The window between the first tag and the refusal is the window in which an image is public and unsigned. In a pipeline that signs by tag rather than by digest, or that scans after pushing, that window is the whole release.
Sign what you pushed, or do not push what you cannot sign. A registry cannot tell the difference.
What the fix changed, and what it could not
The fix is in three parts, and the third is the one that matters.
The per-commit tag is emitted only when Docker Hub answers 404 for it, because only the first build of a commit may claim that name. The kubectl tag gets the same check, because a second release with the same kubectl inside is a second image of the same tool and the tag names the first. And the unsigned release’s page carries a note, because a release whose image is unsigned has to say so where the person deciding whether to pull it will read it:
> **Use [v2.2.1](https://github.com/heyvaldemar/aws-kubectl-docker/releases/tag/v2.2.1).** The 2.2.0 image was pushed, then the run failed before signing, attestation and the Trivy scan, so the 2.2.0 image (and `kube-v1.37.1`, which Docker Hub keeps immutable on it) carries no cosign signature. 2.2.1 is the same Dockerfile, published and signed completely. The cause and the fix are in the 2.2.1 changelog.What the fix cannot do is sign that release after the fact from the workflow that built it. Keyless signing binds the signature to the workflow file and the ref that ran it, and records the run. No run of that release’s workflow can sign that digest without rebuilding it, and a signature from any other workflow would vouch for a build it did not perform. The honest state of that release is unsigned, and the honest response is a pointer to the release that is not.
What the fix did not change is the order, and in the image I publish it did the same thing again on 2 November, through another door. The weekly build pushed latest, edge and the newest kubectl minor’s tag, then the build attestation got a Bad Gateway from Sigstore’s transparency log, and the signing step after it never ran (the weekly run of 2 November). No tag collided and no rule refused anything. For nearly thirty-seven hours latest named an image with no signature, until an unrelated push to main on 4 November replaced it with a signed one, and on 15 November Docker Hub still answered 404 for that image’s signature tag. The moving tags are signed again, and none of the repository’s tags names that image now. The free-check fixed why the first push was refused. The order is the defect. The first release of 15 November changed it: the image is signed before the attestation runs, so a failed attestation still fails the job, but only after the signature is there. The second, that evening, moved the names after the signature, and the next section is that order.
The check I now make after every publish is not “did the version tag appear”. It is “did the signature tag appear”, here as Docker Hub answered it at three thirty-one that afternoon, UTC:
$ curl -s "https://hub.docker.com/v2/repositories/heyvaldemar/aws-kubectl/tags?page_size=6&ordering=last_updated" \> | jq -r '.results[] | "\(.last_updated[0:16]) \(.name)"'2026-09-26T15:30 sha256-e19226bcf00b3fe45096441a1d4d690ae2791e182c68b88ba00eda96738e1ebb.sig2026-09-26T15:30 v2.2.12026-09-26T15:30 22026-09-26T15:30 2.22026-09-26T15:29 2.2.12026-09-26T15:24 sha256-f6cdf04aafc7c3ddf10a8062c6717ac3e5f44ca160d40e838d78ccd74397ec49.sigThe signature tag, the image digest with a sig suffix, is cosign’s signature stored beside the image it signs. A publish that ends without one has published an image and not a release.
Sign the digest first, move the names last
The order that failed here is the default one. GitHub’s starter workflow for publishing a Docker image has it: one step builds and pushes every tag, and the next step signs what was pushed. Whatever fails after the first tag is out and before the signature is in, a registry refusing a later tag, Sigstore answering with a server error, leaves names on an image nobody signed. A pipeline copied from that file has the same window, and a green history says only that nothing has failed inside it yet.
The order failed a third time three days after the second, in another image. On 5 November the kubectl image I publish in place of Bitnami’s frozen one pushed two version tags just after half past three in the afternoon, UTC, then the step that installs cosign got a Gateway Timeout from GitHub four times in seven seconds, and the job failed before it signed anything (the first attempt of that run). The re-run signed a new build at seven minutes past five. For an hour and a half both tags named an image nobody had signed, and on 15 November Docker Hub still answered 404 for its signature. Every tag that repository holds now names a signed image, and none names that one.
A check that runs after the publish only reports a gap like that. The second release of 15 November closes it (the release): cosign is installed before anything is pushed, the build goes to Docker Hub by digest with no tag, the digest is signed, attested and its signature checked on Docker Hub, and only then do the tags move onto it.
# .github/workflows/publish.yml in aws-kubectl-docker at v2.3.2, condensed:# the three steps in their order, comments and the other inputs left out- name: Install cosign before anything is pushed if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3 with: cosign-release: "v2.6.1"
- name: Build and push by digest id: build uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7 with: outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
- name: Sign, attest, name, and read back every tag from Docker Hub if: ${{ !cancelled() && github.event_name != 'pull_request' && steps.meta.outcome == 'success' }} uses: ./.github/actions/sign-attest-verify with: image: ${{ env.IMAGE_NAME }} digest: ${{ steps.build.outcome == 'success' && steps.build.outputs.digest || '' }} tags: ${{ steps.meta.outputs.tags }}The tags go on in one docker buildx imagetools create, with its prefer-index option turned off. Left on, as it is by default, that command wraps a single-platform manifest in a new index, under a digest nobody signed.
If signing fails, no tag moves, and every tag stays on the last signed image. A digest nobody has named is not a release, and one that was never signed now stays nameless.
Framework: know every tag a run emits, push by rule, verify the signature not the version
Of the three layers below, the first is the one this pipeline had skipped.
Layer 1: list every tag every trigger emits, against the registry’s rules (week 1)
Render the metadata action’s output for each event the workflow can receive, and put the list beside the immutability rule. Any tag that a second trigger could emit for a commit a first trigger already published is a refusal waiting for a release day:
# which of the tags a workflow can emit fall under the repository's# immutability rulerule='^(v?[0-9]+\.[0-9]+\.[0-9]+|sha-.*|kube-v.*)$'for tag in latest edge v2.2.0 2.2.0 2.2 2 sha-83be903 kube-v1.37.1; do if printf '%s' "$tag" | grep -qE "$rule"; then echo "immutable $tag"; else echo "movable $tag"; fidoneRead the rule back from the registry rather than from memory; Docker Hub’s repository endpoint returns it in its immutable tags settings field.
Owner: platform engineer, with security signing off on the rule.
Layer 2: a release emits only tags nobody holds, signs by digest, and names last (week 2)
The rules above are the enforcement. Signing covers the digest the build produced, never a tag, so a moved tag cannot carry a signature to an image it was not made for:
# .github/workflows/publish.yml in aws-kubectl-docker at v2.2.1:# sign every tag at the digest the build produced, keyless,# under the run's own identityecho "${TAGS}" | while IFS= read -r tag; do [ -z "$tag" ] && continue echo "Signing: ${tag}@${DIGEST}" cosign sign --yes "${tag}@${DIGEST}"doneA reader verifies against the workflow’s exact identity, the file and the ref, because a pattern that names only the repository accepts a signature from any workflow in it:
# how a reader verifies 2.2.1:# the exact workflow and ref that signed, and the issuer is GitHubcosign verify heyvaldemar/aws-kubectl:2.2.1 \ --certificate-identity 'https://github.com/heyvaldemar/aws-kubectl-docker/.github/workflows/publish.yml@refs/tags/v2.2.1' \ --certificate-oidc-issuer https://token.actions.githubusercontent.comThe names move last, in the order of the section above: pushed by digest, signed, verified, and only then tagged.
Owner: platform engineer.
Layer 3: after every publish, look for the signature tag, and say it on the release page when it is missing (week 3 onward)
A publish is checked for the signature tag beside the digest, not for the version tag, and a release whose image has no signature gets a note in its first line. Nothing in the fleet’s own watchers would have caught the failed tag run: the heartbeat judges push runs of the engine’s own main branch, and the triage reads each template’s main. Since the release of 15 November the publish job runs it after signing: it reads every tag it pushed back from Docker Hub and fails unless the digest behind it carries a signature this workflow made. Until then I ran it by hand after every release, in this form:
# after a publish: the signature tag exists for the digest that was pushed,# or the release is not donesig="sha256-${DIGEST#sha256:}.sig"code="$(curl -s -o /dev/null -w '%{http_code}' "https://hub.docker.com/v2/repositories/${IMAGE_NAME}/tags/${sig}")"case "$code" in 200) echo "signed: ${sig}" ;; 404) echo "::error::no signature tag ${sig} on Docker Hub: the image is published and not signed"; exit 1 ;; *) echo "::error::Docker Hub answered ${code} for ${sig}: not checked, run it again"; exit 1 ;;esacThe check reads the status code, as the workflow’s free-checks already do. A 429 from Docker Hub means not checked, never not signed. Both fail the run, with different words.
The check depends on cosign 2, which stores a signature as that tag. Cosign 3 stores it as an OCI referrer instead, and this check would call every signed release unsigned; the workflow pins a cosign 2 release for that reason, and the check has to change when the pin does.
Owner: SRE, with the release page as the place the note goes.
Tradeoffs
The fix costs two requests to Docker Hub per run, one for each immutable tag, one more conditional in the tag rules, and a release page that admits a mistake in its first line. It also costs the per-commit tag on release builds, which nobody used: the release is named by its version, and the commit is in the provenance.
Leaving the rules as they were costs a release that is public and unverifiable every time a tag lands on a commit main has already published, which for a repository that releases from main after CI is every release. The immutability rule stays. A mutable per-commit tag, the alternative, would have let the push succeed and moved a tag that a consumer might have pinned, which is the exact thing the rule exists to prevent.
The cleaner shape does not rebuild for a release at all. Tag the digest main already published, with docker buildx imagetools create or crane tag, and sign that digest: the release then holds exactly the bytes that passed CI on main, and there is no new digest to collide with anything. That is a larger change to this workflow than a free-check, and it is where it should go next.
Naming after signing has a cost of its own, and it is small. In that order’s first publish from main and in the release run after it, the new digest for kubectl 1.37, the only one I timed, sat on Docker Hub without a signature for about twenty seconds in the first and sixteen in the second, with no name pointing at it. In the first scheduled run of my os-shell image on the same order, on 16 November, it was about a minute, because that build exports its cache before the signature. A retry, when Sigstore or Docker Hub answer with a server error, makes the window longer, and never puts a name on it. The kubectl image took the same order that evening.
Two requests per run, against an image that is out and cannot be signed. Make the requests.
The closing argument
An immutable tag is a promise the registry keeps on your behalf, and it keeps it against you when your workflow forgets it made the promise. A release run must emit only tags nobody holds, sign the digest it built before any name moves onto it, and be judged by whether the signature appeared rather than by whether the version did. The image that shipped unsigned on 26 September will stay unsigned, and its release page says so, because a supply chain is only as honest as the note on the release that broke it.
Sources
- Docker, Immutable tags (tags that cannot be overwritten or deleted once pushed; rules as regular expressions), accessed November 2026
- Docker, the metadata action for GitHub Actions (the sha, semver and ref tag rules and their enable expressions), accessed September 2026
- GitHub, the starter workflow for publishing a Docker image (one step pushes every tag, the next one signs), accessed November 2026
- Docker, docker buildx imagetools create (the prefer-index option, on by default), accessed November 2026
- Sigstore, Signing containers with cosign and Verifying signatures (keyless signing under a workflow identity; signing by digest), accessed September 2026
- SLSA, Provenance, version 1.0 (what the build attestation states about the run that built the image), accessed September 2026
- heyvaldemar, aws-kubectl-docker releases (the unsigned release with its note, and the signed patch release), September 2026
Discussion
If an immutability rule has ever refused your release half way, or you sign and verify container images some other way, drop a comment below. Counterarguments are welcome and the comment thread is where I respond first.