From c62165c18136475f51b4e9726fe5abea6fab7b0e Mon Sep 17 00:00:00 2001 From: ToniAdreal <184365500+ToniAdreal@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:04:10 +0000 Subject: [PATCH] Keep registry and namespace when re-fetching a manifest list in docker-to-squash.py When skopeo returns a manifest list, get_manifest_from_docker_image re-fetches the amd64 manifest by digest, but it builds the new reference from image.split('/', 1)[-1].split(':', 1)[0], which drops the registry and the namespace: registry.example.com/team/app:1.0 is re-fetched as team/app@, and myorg/app:1 as app@ (Docker Hub library/app). Strip only the tag instead: drop any digest part first, then remove a tag only when the last path component contains a colon, so a registry port is never mistaken for a tag. Signed-off-by: ToniAdreal <184365500+ToniAdreal@users.noreply.github.com> --- bin/docker-to-squash.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/docker-to-squash.py b/bin/docker-to-squash.py index 4ea3a371f6b..9c8adb7e063 100755 --- a/bin/docker-to-squash.py +++ b/bin/docker-to-squash.py @@ -366,7 +366,9 @@ def get_manifest_from_docker_image(pull_format, image): if not sha: raise Exception("Could not find amd64 manifest for image " + image) - image_without_tag = image.split("/", 1)[-1].split(":", 1)[0] + image_without_tag = image.split("@", 1)[0] + if ":" in image_without_tag.rsplit("/", 1)[-1]: + image_without_tag = image_without_tag.rsplit(":", 1)[0] image_and_sha = image_without_tag + "@" + sha logging.debug("amd64 manifest sha is: %s", sha)