From 808339b65ebcaebcf3487830ccf74430d2274c42 Mon Sep 17 00:00:00 2001 From: Richard Nienaber Date: Mon, 7 Sep 2026 17:17:37 +0100 Subject: [PATCH] name the registry a pulled image came from, not just its digest `make pull_image` gives the pulled image a local tag, and the daemon then reports a repo digest under that short name as well as under the registry one. Taking the first entry got `prescript-env@sha256:...`, which is the right bytes under a name nobody else can reach -- and a repro line that cannot be pulled is not one. The registry-qualified entry is now picked out by its hostname rather than by being listed first, and a locally built image still falls back to its config digest. Verified both ways round: a pulled image reports ghcr.io/rjnienaber/prescript-env@sha256:6bd7cc..., and one built by `make image` reports sha256:85c296.... Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_019f9gkZVUEo3jtv51GSb4vJ --- docker/run.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker/run.sh b/docker/run.sh index 9e11c64..d7cef6d 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -26,9 +26,16 @@ fi # What a bug report has to name alongside the versions inside the image: which # image. A published image is identified by its registry digest and a locally # built one by its config digest, and either is enough for someone else to get -# the same bytes. -DIGEST="$(docker image inspect \ - --format '{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}{{.Id}}{{end}}' "$IMAGE")" +# the same bytes -- but only if the name in front of the digest is one they can +# reach. `make pull_image` gives the pulled image a local tag, and the daemon +# then reports a digest under that short name as well as under the registry +# one, so the registry-qualified entry is picked out by its hostname rather +# than by being listed first. +DIGESTS="$(docker image inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "$IMAGE")" +DIGEST="$(echo "$DIGESTS" | grep -E '^([^/]+\.[^/]*|localhost(:[0-9]+)?)/' | head -n 1 || true)" +if [ -z "$DIGEST" ]; then + DIGEST="$(docker image inspect --format '{{.Id}}' "$IMAGE")" +fi # Docker's default seccomp profile permits personality() with a handful of # arguments and ADDR_NO_RANDOMIZE is not among them, so fixing the address