Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

plugin/docker: Adding a session when building with buildkit #1937

Merged
merged 3 commits into from
Aug 4, 2021

Conversation

izaaklauer
Copy link
Contributor

@izaaklauer izaaklauer commented Jul 27, 2021

Fixes #1056

Why this change?

We observed that we could replicate #1056 on most of the example repos by enabling buildkit. The failure seems to be governed by the FROM image, but isn't consistent - on my machine, FROM nginx:stable would be fine, but wouldn't work for @xiaolin-ninja. In any case, the error mentions not having a session, and this change fixes it.

Future considerations

The docker CLI's usage of moby sessions is much more sophisticated than this. If you're curious, here's where to start reading. Things they are doing that we are not include:

I haven't found any documentation on what any of this session configuration is for, and would rather not dig deep into the moby code to figure it out at this moment. I'm comforted that img also uses a static session name and blank sharedKey, and because we only ever connect to a local docker daemon, I don't believe this hurts our security model.

I wouldn't be shocked if some advanced combination of buildkit parameters requires the fancy session configuration. At worst though, this change brings building with buildkit from mostly broken to mostly working, so I think it's worth merging.

Dependency for #1881

@izaaklauer izaaklauer requested a review from a team July 29, 2021 17:57
@izaaklauer izaaklauer marked this pull request as ready for review August 2, 2021 13:42
Copy link
Contributor

@krantzinator krantzinator left a comment

Choose a reason for hiding this comment

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

I can't speak to the security model but this fix is 🎉

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

One stupid little comment but this looks good.

builtin/docker/builder.go Outdated Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Nice job getting this working! I've just got a request for more logging in the unsupported case 👍🏻

builtin/docker/builder.go Show resolved Hide resolved
@izaaklauer izaaklauer merged commit c0bd562 into main Aug 4, 2021
@izaaklauer izaaklauer deleted the bug/buildkitSession branch August 4, 2021 13:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dockerfile.v0: failed to create LLB definition: no active sessions
4 participants