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

build: fix stdin handling when building with controller #2394

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

crazy-max
Copy link
Member

fixes #2368

When building in experimental mode we are using the controller which handles io forwarding operations, such as copying data from a reader to a writer and therefore locks stdin from being read in

magic, err := buf.Peek(archiveHeaderSize * 2)

To fix this we can skip forwarding if invoke is not used as it seems to be handled only for this case. We also have a clear condition making it not possible to use a Dockerfile or context from stdin if invoke is used:

buildx/commands/build.go

Lines 397 to 400 in 0a3e5e5

if options.invokeConfig != nil && (options.dockerfileName == "-" || options.contextPath == "-") {
// stdin must be usable for monitor
return nil, errors.Errorf("Dockerfile or context from stdin is not supported with invoke")
}

This should mitigate this issue but might need a deeper look as follow-up

@crazy-max crazy-max force-pushed the fix-stdin-controller branch from 8492eec to 02c4983 Compare April 9, 2024 12:44
@crazy-max crazy-max force-pushed the fix-stdin-controller branch from 02c4983 to ffff87b Compare April 9, 2024 13:01
@crazy-max crazy-max requested review from tonistiigi, jedevc and ktock April 9, 2024 13:16
@crazy-max crazy-max marked this pull request as ready for review April 9, 2024 13:16
Copy link
Collaborator

@ktock ktock left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@crazy-max crazy-max added this to the v0.14.0 milestone Apr 9, 2024
@tonistiigi tonistiigi merged commit 60f4805 into docker:master Apr 9, 2024
67 checks passed
@crazy-max crazy-max deleted the fix-stdin-controller branch April 9, 2024 16:58
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.

Stdin builds hang if BUILDX_EXPERIMENTAL=1 is set
3 participants