support single arch images without manifests when checking platform (#4753)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2026-04-09 11:54:41 -04:00 committed by GitHub
parent f618917527
commit 344d1f47a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,11 +135,17 @@ func checkArchitecturesMatch(imageReference, platform string) (bool, string, err
// prefer the manifest list for platform info — with Docker's containerd image store, // prefer the manifest list for platform info — with Docker's containerd image store,
// platform metadata lives on the manifest list entry, not in the image config. // platform metadata lives on the manifest list entry, not in the image config.
if found, err := platformInManifest(imageReference, platform); err == nil { // Only return early on a positive match; otherwise fall through to image inspect
return found, platform, nil // to get the actual platform (needed for accurate error messages and single-arch images
// that don't have a manifest list).
if found, err := platformInManifest(imageReference, platform); err == nil && found {
return true, platform, nil
} }
// fall back to image config for older Docker daemons that don't support "docker manifest inspect" // fall back to image config when:
// - manifest inspect failed (older Docker daemons)
// - image has no manifest list (single-arch images)
// - platform not found in manifest list (get actual platform for error message)
gotPlatform, err := platformFromImageInspect(imageReference) gotPlatform, err := platformFromImageInspect(imageReference)
if err != nil { if err != nil {
return false, "", err return false, "", err