buildah
buildah copied to clipboard
buildah is unable to push an image for a non-default platform
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.
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.
Yes, either buildah manifest push --all or podman push should push both the manifest list and the image.
Thanks for the answers to both of you @mtrmac, @nalind!
Yes, either
buildah manifest push --allorpodman pushshould 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.
A friendly reminder that this issue had no activity for 30 days.
@nalind Should we close this or better document the current behaviour?
Either the latter, or tweak how push works.
A friendly reminder that this issue had no activity for 30 days.