Skip to content

Conversation

@orgads
Copy link

@orgads orgads commented Nov 11, 2025

When building multi-platform images with bake where target contexts reference other targets, a segmentation fault occurred when calling ToState() on nil references in the Refs map.

This occurs with platform-independent builds (e.g., "FROM scratch") where BuildKit optimizes by not materializing separate references for identical content across platforms, resulting in nil entries in the Refs map.

The fix adds a nil check to skip nil references, consistent with how BuildKit's own code handles such cases.

Fixes #3508

When building multi-platform images with bake where target contexts
reference other targets, a segmentation fault occurred when calling
ToState() on nil references in the Refs map.

This occurs with platform-independent builds (e.g., "FROM scratch")
where BuildKit optimizes by not materializing separate references for
identical content across platforms, resulting in nil entries in the Refs map.

The fix adds a nil check to skip nil references, consistent with how
BuildKit's own code handles such cases.

Fixes docker#3508

Signed-off-by: GitHub Copilot <[email protected]>
Signed-off-by: Orgad Shaneh <[email protected]>
@orgads orgads force-pushed the scratch-multiarch-crash branch from 71fe24c to 3d4ec3a Compare November 11, 2025 20:45
@orgads
Copy link
Author

orgads commented Nov 11, 2025

@tonistiigi Sorry, I didn't notice you already pushed #3511. Thanks! You can grab the test if you want :)

@orgads orgads closed this Nov 11, 2025
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.

segmentation fault on multi-image build with bake

1 participant