-
Notifications
You must be signed in to change notification settings - Fork 797
rootless: enable IPv6 in RootlessKit network namespace #5055
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
e4ce633
07c3675
99131c3
5e18ed0
462e8d8
6f5ebe8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,6 +165,11 @@ Rootless containerd recognizes the following environment variables to configure | |
| the host loopback IP address (127.0.0.1) and abstract sockets are exposed to Dockerfile's "RUN" instructions during `nerdctl build` (not `nerdctl 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` | ||
| * `CONTAINERD_ROOTLESS_ROOTLESSKIT_IPV6=(true|false)`: whether to enable IPv6 inside the RootlessKit network namespace. | ||
| Defaults to "false". After enabling this, create IPv6-capable CNI networks with | ||
| `nerdctl network create --ipv6 --subnet <v6-subnet>` as usual. Published ports over IPv6 are | ||
| supported with `--port-driver=builtin` (the default). `--port-driver=slirp4netns` does not yet | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work with pasta too? (
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested this with pasta and --port-driver=implicit, but it currently fails during port exposure with no PortDriver is available. It looks like nerdctl's rootless-port hook expects the PortDriver API to be active when -p is passed, which isn't the case under implicit. I've updated the docs in 5e18ed0 to explicitly note that pasta isn't supported for IPv6 port forwarding yet. |
||
| support IPv6 port forwarding upstream. | ||
|
|
||
| To set these variables, create `~/.config/systemd/user/containerd.service.d/override.conf` as follows: | ||
| ```ini | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| package rootlessutil | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "errors" | ||
| "fmt" | ||
| "os" | ||
|
|
@@ -119,3 +120,25 @@ func WithDetachedNetNSIfAny(fn func() error) error { | |
| } | ||
| return ns.WithNetNSPath(netns, func(_ ns.NetNS) error { return fn() }) | ||
| } | ||
|
|
||
| // RootlessKitIPv6Enabled reports whether the running RootlessKit parent process was launched with --ipv6. | ||
| func RootlessKitIPv6Enabled() bool { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you should rather add
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks that is a better approach I've opened rootless-containers/rootlesskit#607 to add the IPv6 boolean to NetworkDriverInfo could you take a look at that pr when you have a chance?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider moving this to testutil pkg |
||
| stateDir, err := RootlessKitStateDir() | ||
| if err != nil { | ||
| return false | ||
| } | ||
| pid, err := RootlessKitChildPid(stateDir) | ||
| if err != nil { | ||
| return false | ||
| } | ||
| cmdline, err := os.ReadFile(filepath.Join("/proc", strconv.Itoa(pid), "cmdline")) | ||
| if err != nil { | ||
| return false | ||
| } | ||
| for _, arg := range bytes.Split(cmdline, []byte{0}) { | ||
| if string(arg) == "--ipv6" { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.