Skip to content

fix: Default to a rootless Buildkit container - #2978

Closed
gerhard wants to merge 1 commit into
dagger:mainfrom
gerhard:use-rootless-buildkit-image
Closed

gerhard wants to merge 1 commit into
dagger:mainfrom
gerhard:use-rootless-buildkit-image

Conversation

@gerhard

@gerhard gerhard commented Aug 25, 2022

Copy link
Copy Markdown
Contributor

Instead of using --privileged with the default buildkit container, use a rootless one which makes it safer: https://github.com/moby/buildkit/blob/master/docs/rootless.md#docker

One reason to not remove remove privileged is that our pipelines will break, as well as our users'.

This is the first step towards attempting to start addressing #151.

While this does not solve the issue, it will inform us if this is a step in the right direction and, more importantly, if this is still worth fixing.

We (+@slumbering) are on a mission to close old issues!

@slumbering slumbering linked an issue Aug 25, 2022 that may be closed by this pull request
@gerhard

gerhard commented Aug 25, 2022

Copy link
Copy Markdown
Contributor Author

@gerhard

gerhard commented Aug 25, 2022

Copy link
Copy Markdown
Contributor Author

Btw, when we removed --privileged, dagger do lint would fail:

image

That change seems to involve even more work than just switching to a rootless container.

@gerhard gerhard changed the title chore: Default to a rootless Buildkit container fix: Default to a rootless Buildkit container Aug 25, 2022
@gerhard
gerhard marked this pull request as ready for review August 25, 2022 14:57
@gerhard
gerhard requested a review from a team as a code owner August 25, 2022 14:57
@gerhard
gerhard requested review from grouville and shykes August 25, 2022 14:57
Instead of using --privileged with the default buildkit container, use a
rootless one which makes it safer:
https://github.com/moby/buildkit/blob/master/docs/rootless.md#docker

One reason to *not* remove remove privileged is that our pipelines will
break, as well as our users'.

This is the first step towards attempting to start addressing
#151

While this does not solve the issue, it will inform us if this is a step
in the right direction and, more importantly, if this is still worth fixing.

We (+JF) are on a mission to close old issues!

Co-authored-by: Jean-François Farge <[email protected]>
Signed-off-by: Gerhard Lazu <[email protected]>
@gerhard
gerhard requested review from aluzzardi, samalba and sipsma and removed request for grouville and shykes August 25, 2022 14:58
@aluzzardi

Copy link
Copy Markdown
Contributor

/cc @sipsma

Any side effects in doing this?

@sipsma

sipsma commented Sep 1, 2022

Copy link
Copy Markdown
Contributor

Any side effects in doing this?

Yeah, while rootless works if you set it up just right, there are a ton of tradeoffs. Many of the tradeoffs are really subtle, which makes them hard to decide automatically on a user's behalf. Some examples:

  1. Even if we switch to the rootless image, we still need to provide either --privileged or a magic incantation of --security-opts plus a setting that causes buildkit's inner containers to run unsandboxed. https://github.com/moby/buildkit/blob/master/docs/rootless.md#docker
  2. Right now I think we end up running all of buildkit's containers without a network namespace, but as I understand it, that was not desired forever. However, if we switch to rootless mode, non-host networking becomes complicated because most operations that move network devices between network namespaces require capabilities.
    • The generic solution in rootlesskit (used by the rootless buildkit images) is to use slirp, which is an entire tcp/ip stack implemented in userspace (originally for qemu) but that has large performance penalties.
  3. Which snapshotter will be usable inside the rootless containers involves an insane matrix of kernel version, configuration, fuse availability, upstream kernel patches used by certain distros, etc. Any users that end up not being able to use the default overlayfs snapshotter will most likely experience noticeable slowdowns (with either the fuse-overlayfs implementation or especially the native copy-based one).

Overall, I think this route will unfortunately lead to the pain of dealing with lots of host-specific configuration, at least for now.

@gerhard

gerhard commented Sep 5, 2022

Copy link
Copy Markdown
Contributor Author

Thank you @sipsma & @aluzzardi for your feedback. This sounds like a step in the wrong direction.

Closing.

@gerhard gerhard closed this Sep 5, 2022
@gerhard
gerhard deleted the use-rootless-buildkit-image branch September 22, 2022 08:38
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