-
Notifications
You must be signed in to change notification settings - Fork 612
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
[Carry 2535] rootless: support detach-netns mode #2723
Conversation
fb193e0
to
adb89ad
Compare
752703f
to
5119337
Compare
This comment was marked as resolved.
This comment was marked as resolved.
b0df933
to
18acfa9
Compare
This comment was marked as resolved.
This comment was marked as resolved.
79513ca
to
fd56c62
Compare
This comment was marked as resolved.
This comment was marked as resolved.
3d57868
to
fd2ed9c
Compare
# The "detached-netns" mode accelerates `nerdctl (pull|push|build)` and enables `nerdctl run --net=host`, | ||
# however, there is a relatively minor drawback with the current version of BuildKit: | ||
# the host loopback IP address (127.0.0.1) is exposed to Dockerfile's "RUN" instructions during `nerdctl build` (not `nerdctl run`). | ||
# If you want to hide 127.0.0.1 from "RUN" instructions, you should set CONTAINERD_ROOTLESS_ROOTLESSKIT_DETACH_NETNS to "false". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@containerd/nerdctl-maintainers
This is kinda breaking change.
Let me know we should release this as "nerdctl v2.0" (ahead of containerd v2.0), or we can just stick to "nerdctl v1.8".
I'm leaning toward to the former one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nerdctl v2.0
SGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nerdctl v2.0
SGTM
fd2ed9c
to
457ecc6
Compare
457ecc6
to
41135e2
Compare
41135e2
to
f407714
Compare
f407714
to
0746dcc
Compare
cebf66f
to
5d31647
Compare
5d31647
to
b7799e5
Compare
# The "detached-netns" mode accelerates `nerdctl (pull|push|build)` and enables `nerdctl run --net=host`, | ||
# however, there is a relatively minor drawback with the current version of BuildKit: | ||
# the host loopback IP address (127.0.0.1) is exposed to Dockerfile's "RUN" instructions during `nerdctl build` (not `nerdctl run`). | ||
# If you want to hide 127.0.0.1 from "RUN" instructions, you should set CONTAINERD_ROOTLESS_ROOTLESSKIT_DETACH_NETNS to "false". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nerdctl v2.0
SGTM
var addrs []net.Addr | ||
if err := rootlessutil.WithDetachedNetNSIfAny(func() error { | ||
var err2 error | ||
addrs, err2 = net.InterfaceAddrs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think this is what I was missing in my PR; I wasn't pointing to the right IP addresses, right? It's not an issue with runc
as we discussed in Chicago.
thanks @AkihiroSuda LGTM overall, just this small typo Thanks again for taking the time to address this feature |
Will rebase when BuildKit v0.13 beta2 is released |
6994e39
to
d3d2da7
Compare
d3d2da7
to
c4a967d
Compare
Signed-off-by: Akihiro Suda <[email protected]>
c4a967d
to
0f458cf
Compare
Signed-off-by: Akihiro Suda <[email protected]>
Signed-off-by: Akihiro Suda <[email protected]>
When RootlessKit v2.0 (rootless-containers/rootlesskit PR 379) is installed, `containerd-rootless.sh` launches it with `--detach-netns` so as to run the daemon in the host network namespace. This will enable: - Accelerated (and deflaked) `nerdctl pull`, `nerdctl push`, `nerdctl build`, etc - Proper support for `nerdctl pull 127.0.0.1:.../...` - Proper support for `nerdctl run --net=host` Replaces Fahed Dorgaa's PR 2535 Co-authored-by: fahed dorgaa <[email protected]> Signed-off-by: Akihiro Suda <[email protected]>
0f458cf
to
4892364
Compare
When RootlessKit v2.0 (rootless-containers/rootlesskit#379) is installed,
containerd-rootless.sh
launches it with--detach-netns
so as to run the daemon in the host network namespace.This will enable:
nerdctl pull
,nerdctl push
,nerdctl build
, etcnerdctl pull 127.0.0.1:.../...
nerdctl run --net=host
Replaces Fahed Dorgaa's PR #2535
Fixes #814
Fixes #86
Note
Rootless containerd recognizes the following environment variables to configure the behavior of RootlessKit:
CONTAINERD_ROOTLESS_ROOTLESSKIT_DETACH_NETNS=(auto|true|false)
: whether to launch rootlesskit with the "detach-netns" mode.Defaults to "auto", which is resolved to "true" if RootlessKit >= 2.0 is installed.
The "detached-netns" mode accelerates
nerdctl (pull|push|build)
and enablesnerdctl run --net=host
,however, there is a relatively minor drawback with BuildKit prior to v0.13:
the host loopback IP address (127.0.0.1) is exposed to Dockerfile's "RUN" instructions during
nerdctl build
(notnerdctl run
).The drawback is fixed in BuildKit v0.13. Upgrading from a prior version of BuildKit needs removing the old systemd unit:
containerd-rootless-setuptool.sh uninstall-buildkit && rm -f ~/.config/buildkit/buildkitd.toml
To set these variables, create
~/.config/systemd/user/containerd.service.d/override.conf
as follows:And then run the following commands:
https://github.com/containerd/nerdctl/blob/main/docs/rootless.md