Skip to content

bake: Fix always building Linux binaries#128

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
vvoland:fix-binarieslinux
Mar 20, 2026
Merged

bake: Fix always building Linux binaries#128
dmcgowan merged 1 commit intocontainerd:mainfrom
vvoland:fix-binarieslinux

Conversation

@vvoland
Copy link
Contributor

@vvoland vvoland commented Mar 20, 2026

Commit a4eb9d7 introduced _host_common which passed TARGETOS as an explicit build arg set to HOST_OS (default "linux").

This overrode Docker's automatic platform-injected TARGETOS variable, so the shim always built for linux regardless of the target platform set via --platform or platforms.

Replace the TARGETOS build arg with the platforms field on _host_common so Docker's platform mechanism correctly injects TARGETOS and TARGETARCH

Copilot AI review requested due to automatic review settings March 20, 2026 11:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Docker Bake configuration to stop overriding BuildKit’s platform-injected TARGETOS and instead drive host-binary builds via platforms, so TARGETOS/TARGETARCH are derived from the selected platform.

Changes:

  • Add _DOCKER_ARCH to translate KERNEL_ARCH values into Docker platform arch names.
  • Replace _host_common’s explicit TARGETOS build-arg override with a platforms declaration.
  • Make libkrun explicitly build for linux/${_DOCKER_ARCH} instead of inheriting _host_common.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vvoland vvoland force-pushed the fix-binarieslinux branch from 63bb023 to 52a7127 Compare March 20, 2026 12:03
Commit a4eb9d7 introduced _host_common which passed TARGETOS as an
explicit build arg set to HOST_OS (default "linux").

This overrode Docker's automatic platform-injected TARGETOS variable, so
the shim always built for linux regardless of the target platform set
via --platform or platforms.

Replace the TARGETOS build arg with the platforms field on _host_common
so Docker's platform mechanism correctly injects TARGETOS and TARGETARCH

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Copilot AI review requested due to automatic review settings March 20, 2026 16:48
@vvoland vvoland force-pushed the fix-binarieslinux branch from 52a7127 to 4bcbf99 Compare March 20, 2026 16:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dmcgowan dmcgowan merged commit 222b4ad into containerd:main Mar 20, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants