"""Read-only Docker Hub manifest check; never prints anonymous registry tokens.""" import json import httpx images = { "python": "3.12-slim-bookworm", "redis": "8.2-alpine", "postgres": "17-alpine", "caddy": "2-alpine", } with httpx.Client(timeout=30, follow_redirects=True) as client: output = [] for name, tag in images.items(): token_response = client.get("https://auth.docker.io/token", params={"service": "registry.docker.io", "scope": f"repository:library/{name}:pull"}) token_response.raise_for_status() token = token_response.json()["token"] response = client.get(f"https://registry-1.docker.io/v2/library/{name}/manifests/{tag}", headers={ "Authorization": "Bearer " + token, "Accept": "application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json"}) response.raise_for_status() manifests = response.json().get("manifests", []) arm = [x for x in manifests if x.get("platform", {}).get("architecture") == "arm64" and x.get("platform", {}).get("os") == "linux"] if not arm: raise RuntimeError(f"No linux/arm64 manifest for {name}:{tag}") output.append({"image": f"{name}:{tag}", "arm64_digest": arm[0]["digest"]}) print(json.dumps(output, indent=2))