Skip to content

FROM --platform=<os/arch> Containerfile construct picks the wrong platform with image index #6091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
syedriko opened this issue Mar 27, 2025 · 4 comments
Assignees
Labels
jira Issues which will be sync'd to a card at https://issues.redhat.com/projects/RUN stale-issue

Comments

@syedriko
Copy link

syedriko commented Mar 27, 2025

Containerfile:

FROM --platform=linux/amd64 ${BASE_IMAGE} as base_image

When building an image with the above fragment of Containerfile on linux/aarch64, it appears that if BASE_IMAGE refers to an image index, FROM --platform=linux/amd64 fails to look for the linux/amd64 image and instead looks for the platform the build is running on, linux/aarch64.

The build running on linux/aarch64 fails with the following error message:

Trying to pull quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/own-app-lightspeed-rag-content@sha256:3bff77ee31f1c1ac0351bef86809c0aeef58626779941d14e08fe21bc62816eb...
Error: choosing an image from manifest list docker://quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/own-app-lightspeed-rag-content@sha256:3bff77ee31f1c1ac0351bef86809c0aeef58626779941d14e08fe21bc62816eb: no image found in image index for architecture "arm64", variant "v8", OS "linux"

If, on the other hand, BASE_IMAGE refers directly to an image, --platform=linux/amd64 is honored.

@syedriko syedriko changed the title FROM --platform=<os/arch> Containerfile contruct picks the wrong platform with image index FROM --platform=<os/arch> Containerfile construct picks the wrong platform with image index Mar 27, 2025
@mheon
Copy link
Member

mheon commented Mar 27, 2025

@flouthoc PTAL

@flouthoc flouthoc self-assigned this Mar 27, 2025
@flouthoc
Copy link
Collaborator

I'll take a look thanks.

@flouthoc flouthoc added the jira Issues which will be sync'd to a card at https://issues.redhat.com/projects/RUN label Mar 27, 2025
@syedriko
Copy link
Author

syedriko commented Mar 28, 2025

I'm having trouble putting together an isolated test case for this. Even the exact image that failed in the Konflux build ^^^ works:

$ cat Containerfile.test.fail 
FROM --platform=linux/amd64 quay.io/redhat-user-workloads/crt-nshift-lightspeed-tenant/own-app-lightspeed-rag-content@sha256:3bff77ee31f1c1ac0351bef86809c0aeef58626779941d14e08fe21bc62816eb as base-amd64
FROM --platform=$BUILDPLATFORM registry.redhat.io/ubi9/ubi-minimal:latest
COPY --from=base-amd64 /etc/os-release .
$ 

This is on Fedora 41 arm64, with

$ buildah --version
buildah version 1.39.2 (image-spec 1.1.0, runtime-spec 1.2.0)
$ 

I've also tried building buildah 1.39.3 and 1.40.0-dev from source, which both worked. There must be a key difference between how Konflux runs buildah and what I'm doing.

Copy link

A friendly reminder that this issue had no activity for 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira Issues which will be sync'd to a card at https://issues.redhat.com/projects/RUN stale-issue
Projects
None yet
Development

No branches or pull requests

3 participants