Skip to content
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

dockerfile: detect base image with wrong platform being used #4924

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonistiigi
Copy link
Member

Detect the case where the resolved base image does not match the expected platform from request. This can happen in two main cases:

  • Single arch image manifest for a wrong platform than expected by the build
  • Wrong metadata info in the image config (common for cross-compiled images pre buildkit and --platform flag).

Fixes docker/buildx#844

This isn't directly a linter issue as Dockerfile is not using a wrong command/flag but the base image is problematic. I still used the same naming schema but we probably don't want to include it in the rules docs.

Copy link
Collaborator

@jsternberg jsternberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes requested. Otherwise seems good to me.

frontend/dockerfile/dockerfile2llb/convert.go Outdated Show resolved Hide resolved
frontend/dockerfile/dockerfile_test.go Show resolved Hide resolved
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi added this to the v0.14.0 milestone May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

buildx build --platform ... uses wrong image
2 participants