-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Podman v5 no longer builds Dockerfiles with build args used as --platform in FROM instruction #23046
Comments
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 openshift/imagebuilder#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 containers/buildah#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 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}"
Successful output
If I remove # 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}"
|
There is a podman bug that needs to be resolved which required adding this out of stage directive. Unfortunately that broke the image build for docker, which we use heavily. This is a terrible hack until the bug in podman is resolved. containers/podman#23046
A friendly reminder that this issue had no activity for 30 days. |
I'm also having this issue with podman 5.2.2 Previously it was working with a containerfile such as:
Now it produces an error:
Removing the default value of TARGETPLATFORM gets rid of the error, but it seems like it will always use the current platform - it cannot be passed as an argument:
See If I use a custom argument name, then it works:
|
|
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 via
podman 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
podman build -f Dockerfile .
Podman must be version 5+Error: no value specified for --platform=
Repeat the steps with Podman v4 - error doesn't happen
Describe the results you received
Podman build fails with
Error: no value specified for --platform=
(Podman v5)Describe the results you expected
Podman v5 would build the image as it works with Podman v4
podman info output
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.The text was updated successfully, but these errors were encountered: