fix: use native platform for Dockerfile builder stage to avoid QEMU arm64 failures#3157
Open
andyzhangx wants to merge 2 commits into
Open
fix: use native platform for Dockerfile builder stage to avoid QEMU arm64 failures#3157andyzhangx wants to merge 2 commits into
andyzhangx wants to merge 2 commits into
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andyzhangx The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
This PR updates the Linux plugin image build to avoid running the builder stage under QEMU emulation when producing arm64 images on amd64 CI hosts, reducing intermittent Exec format error failures during apt install in the builder stage.
Changes:
- Run the
builderstage using--platform=$BUILDPLATFORMso it executes natively on the build host. - Switch azcopy download selection from a custom
ARCHarg to BuildKit’sTARGETARCH.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The builder stage only needs to download azcopy binaries and the Microsoft apt repo deb. Running apt install under QEMU emulation for arm64 intermittently fails with 'Exec format error' when binfmt registration is unstable in CI Docker-in-Docker environments. By using --platform=$BUILDPLATFORM, the builder always runs natively (amd64) and downloads the correct arch-specific azcopy binary via TARGETARCH, eliminating the QEMU dependency for this stage.
4aee7c7 to
d0398a9
Compare
Give TARGETARCH a default of 'amd64' so the azcopy download URL is always valid even when not running under BuildKit/buildx.
2886689 to
8a01705
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What this PR does / why we need it:
The builder stage in the Dockerfile runs
apt install curlunder QEMU emulation when building arm64 images on amd64 CI hosts. This intermittently fails withExec format errorwhen the binfmt registration is unstable in Docker-in-Docker environments.By using
--platform=$BUILDPLATFORM, the builder stage always runs natively (amd64) and downloads the correct arch-specific azcopy binary viaTARGETARCH. This eliminates the QEMU dependency for the builder stage while keeping the final image on the correct target architecture.How
BUILDPLATFORMandTARGETARCHwork:Both
BUILDPLATFORMandTARGETARCHare BuildKit automatic platform ARGs. When usingdocker buildx build --platform=linux/<arch>, BuildKit automatically injects the correct values, overriding any Dockerfile defaults:make container-linux ARCH=arm64→--platform=linux/arm64→ BuildKit setsTARGETARCH=arm64→ downloadsazcopy_linux_arm64_10.32.4.tar.gz✅make container-linux ARCH=amd64→--platform=linux/amd64→ BuildKit setsTARGETARCH=amd64→ downloadsazcopy_linux_amd64_10.32.4.tar.gz✅docker build(no buildx) → no injection → falls back to defaults (BUILDPLATFORM=linux/amd64,TARGETARCH=amd64) ✅The defaults (
BUILDPLATFORM=linux/amd64,TARGETARCH=amd64) are only a safety net for non-BuildKit builds. In CI,container-linuxalways usesdocker buildx --platform="linux/$(ARCH)", so BuildKit injects the actual target arch automatically.Which issue(s) this PR fixes:
Fixes intermittent arm64 image build failures in CI (e.g.
pull-azurefile-csi-driver-external-e2e-nfs).Does this PR introduce a user-facing change?