Open phandox opened 1 week ago
I don't think this worked back in 4.9.4. Near as I can tell, the ARG value from the heading wasn't being evaluated there, effectively causing it to be treated as if no value was supplied, and that most-likely-an-error was quietly ignored. Opened https://github.com/openshift/imagebuilder/pull/286 to fix it.
Ah, @baude corrected me - it did pay attention to arg values supplied in the header, but ignored those supplied from elsewhere.
Hi @nalind thank you for looking into issue! I see that https://github.com/containers/buildah/pull/5599 was merged - will it be incorporated in next release of Podman?
Yes
I think I may be hitting this issue as well. The behavior of Docker is to add platform args to the global scope. I am using TARGETARCH
in a FROM
statement. In order for it to work, I have to declare ARG TARGETARCH
even though in my case I'm not using it any of the build stages (as demonstrated by the empty value from command in the first stage).
ARG TARGETARCH # Without this, the build fails in podman but succeedes with docker
FROM alpine as base
RUN echo "Arch is $TARGETARCH"
FROM --platform=amd64 base AS build-amd64
ENV BUILD="Building for x86"
FROM --platform=amd64 base AS build-arm64
ENV BUILD="Building for ARM"
FROM build-${TARGETARCH} AS final
RUN echo "${BUILD}"
If I remove ARG TARGETARCH
from the global scope, the build failes with podman (but completes successfully with docker).
# ARG TARGETARCH
FROM alpine as base
RUN echo "Arch is $TARGETARCH"
FROM --platform=amd64 base AS build-amd64
ENV BUILD="Building for x86"
FROM --platform=amd64 base AS build-arm64
ENV BUILD="Building for ARM"
FROM build-${TARGETARCH} AS final
RUN echo "${BUILD}"
> podman build --no-cache -t test -f Containerfile .
[4/4] STEP 1/2: FROM build-arm64 AS final
Resolving "build-arm64" using unqualified-search registries (/etc/containers/registries.conf.d/999-podman-machine.conf)
Trying to pull docker.io/library/build-arm64:latest...
Error: creating build container: initializing source docker://build-arm64:latest: reading manifest latest in docker.io/library/build-arm64: requested access to the resource is denied
Issue Description
Hi,
since Podman v5, our existing Dockerfiles which uses this pattern:
no longer builds and errors out on
--platform
not having any value. Here is output from podman v5 (running viapodman run -v ${PWD}:/app -it --rm --privileged quay.io/podman/stable:v5.1-immutable
)Same Dockerfile works in Podman 4.9.4 (running with
podman run -v ${PWD}:/app -it --rm --privileged quay.io/podman/stable:v4.9.4-immutable
)Steps to reproduce the issue
Steps to reproduce the issue
FROM --platform=${PLATFORM} busybox
ARG PLATFORM
RUN echo "platform: ${PLATFORM}"
Podman in a container
Yes
Privileged Or Rootless
Privileged
Upstream Latest Release
Yes
Additional environment details
Testing with Podman in Podman, with --privileged flag. Can be reproduced also on Google Kubernetes Engine, where we run our CI jobs from Gitlab Runners (using the quay.io/podman/stable:v5.1-immutable image).
Additional information
Happens all the time, doesn't matter if
--build-arg
is passed withpodman build
command.