Skip to content

FROM --platform=$BUILDPLATFORM alpine-$BUILDARCH uses TARGETARCH manifest #4237

@AkihiroSuda

Description

@AkihiroSuda

dockerfile:

# alpine-ARCH pattern is used in https://github.com/moby/buildkit/blob/v0.12.2/Dockerfile#L26-L33
FROM alpine:3.18 AS alpine-amd64
FROM alpine:3.18 AS alpine-arm64

FROM --platform=$BUILDPLATFORM alpine-$BUILDARCH
RUN set -x; [ "$(uname -m)" = "x86_64" ]
# Expected result (on amd64 hosts): "x86_64"
# Actual result: "aarch64"

On amd64 hosts, buildctl build --opt platform=arm64 fails, as BuildKit unexpectedly uses TARGETARCH manifest.

A workaround is to use FROM --platform=$BUILDPLATFORM alpine:3.18 directly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions