sudo apt-get install -y buildah -o Dpkg::Options::="--force-overwrite"
But I'm lucky. This order works.
However, it may be necessary to inform this fault in the document.
FROM --platform=$BUILDPLATFORM alpine
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN echo "I'm compiling for $TARGETPLATFORM on $BUILDPLATFORM and tagging for $TARGETPLATFORM"
Wrong output.
I'm compiling for linux/amd64 on linux/amd64 and tagging for linux/amd64
Correct output.
I'm compiling for linux/arm64 on linux/amd64 and tagging for linux/arm64
https://github.com/containers/buildah/pull/3899/commits/bee0a1ff2ef91dc819d28317d7f20cf946b1dc25 Basically, it can be confirmed that the
TARGETPLATFORM
variable of buildah earlier than 1.26.0 is faulty. But even the buildah version in the Ubuntu 22.04 software source is only 1.23.1. This is obviously not enough, so I tried to install a higher version of buildah, but encountered difficulties. https://github.com/actions/virtual-environments/issues/2703#issuecomment-1186525467sudo apt-get install -y buildah -o Dpkg::Options::="--force-overwrite"
But I'm lucky. This order works. However, it may be necessary to inform this fault in the document.Examples.
$ buildah build --platform linux/arm64 .
Wrong output.
I'm compiling for linux/amd64 on linux/amd64 and tagging for linux/amd64
Correct output.
I'm compiling for linux/arm64 on linux/amd64 and tagging for linux/arm64