Skip to content
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

buildah is unable to push an image for a non-default platform #5637

Open
santiagorr opened this issue Jul 17, 2024 · 7 comments
Open

buildah is unable to push an image for a non-default platform #5637

santiagorr opened this issue Jul 17, 2024 · 7 comments

Comments

@santiagorr
Copy link

If I build an image for a non-default platform, e.g. i386 on amd64, armhf or armel on arm64, without building the image for the default platform, buildah is not able to push it. It complains because it doesn't find the default platform-image:

buildah push build-essential <registry>
Error: pushing image "build-essential" to "<registry>": no image found in image index for architecture amd64, variant "", OS linux: image not known

I can reproduce it locally with a simple Dockerfile:

FROM debian:unstable
ARG ARCH=amd64
RUN apt-get update
RUN apt-get -y install build-essential

and building it with:

buildah build --build-arg ARCH=i386 --platform "linux/i386" --manifest build-essential

The error comes from chooseInstance(): https://github.com/containers/image/blob/main/internal/manifest/oci_index.go#L264

Building the default platform additionally fixes the issue (I am able to push the image), but I need to avoid that.

@mtrmac
Copy link
Contributor

mtrmac commented Jul 18, 2024

Thanks for your report.

If I understand the situation right, that behavior of c/image is, on its terms, correct. buildah build --manifest … creates a multi-platform image, and then buildah push is trying to push (what the code expects to be) a single-platform image without explicitly choosing a non-default platform.

Buildah’s code must choose to trigger a multi-platform push (or, alternatively, use options that let the user choose the desired platform for a single-platform push).

I suspect that code already exists in buildah, and this is already possible, using buildah manifest push or maybe buildah push --all, but I’m not immediately sure. Anyway, transferring to Buildah for these details.

@mtrmac mtrmac transferred this issue from containers/image Jul 18, 2024
@nalind
Copy link
Member

nalind commented Jul 18, 2024

Yes, either buildah manifest push --all or podman push should push both the manifest list and the image.

@santiagorr
Copy link
Author

Thanks for the answers to both of you @mtrmac, @nalind!

Yes, either buildah manifest push --all or podman push should push both the manifest list and the image.

You are right, both commands are able to push the single-non-default-platform-image, but buildah push ... or buidah push --all ... don't.

Copy link

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

@rhatdan
Copy link
Member

rhatdan commented Aug 19, 2024

@nalind Should we close this or better document the current behaviour?

@nalind
Copy link
Member

nalind commented Aug 21, 2024

Either the latter, or tweak how push works.

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
Projects
None yet
Development

No branches or pull requests

4 participants