Skip to content

Cross platform image builds should fail if the base container architecture doesn't match #3854

@nickdig

Description

@nickdig

Description

Description

Buildx should do a better job of identifying and failing image builds that are using base images with mismatching platforms.

Example

Dockerfile

FROM my-base-image-amd64
RUN install gcc

Docker Build

docker build --platform=linux/arm64 -t my-gcc-image-arm64 .

Result

The above command will run and build an image with a platform of arm64 despite actually being an amd64 image.

Suggestion

While the example is user error, the buildx system should be able to detect this and fail fast. When building multiplatform, it's easy to lose track of the image platform. Especially for images upstream in the build process.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions