Allow running dockerd as a non-root user (Rootless mode)#38050
Allow running dockerd as a non-root user (Rootless mode)#38050thaJeztah merged 1 commit intomoby:masterfrom
Conversation
483ab2e to
e183cfb
Compare
abb3322 to
79c8968
Compare
Codecov Report
@@ Coverage Diff @@
## master #38050 +/- ##
=========================================
Coverage ? 36.54%
=========================================
Files ? 610
Lines ? 45368
Branches ? 0
=========================================
Hits ? 16581
Misses ? 26497
Partials ? 2290 |
|
How can you delegate cgroups? A piece of work prior to this might be supporting cgroup namespace? |
Cgroups delegation is disabled on this PR and it is likely to be a separate PR in future. Until we can get full cgroups v2 support in runc (blocked due to lack of freezer and device subsystems, see opencontainers/runc#654), we would need to use |
thaJeztah
left a comment
There was a problem hiding this comment.
Not too familiar with all the requirements to make this work, but had a quick glance over, and left some comments/suggestions 🤗
|
addressed comments |
|
Ah I was looking at libproxy in vpnkit and assumed that was what was being used :( Well, IF these are tcp conns being proxied there, io.Copy will use splice(2) on Linux instead of a user space copy. |
|
Updated to use prebuilt djs55/vpnkit binary. Support for non-amd64 and slirp4netns can be discussed in follow-up PR series. |
There was a problem hiding this comment.
Wonder if we can build from source; there's a Dockerfile in the repo to build vpnkit https://github.com/moby/vpnkit/blob/master/Dockerfile, but not sure we should copy that (perhaps the steps from the Dockerfile could be move into the Makefile? @djs55 - think that would work?
There was a problem hiding this comment.
It requires more than 10 minutes...
Any chance to get non-amd64 prebuilt binaries?
There was a problem hiding this comment.
@djs55 Is it possible to cross-compile vpnkit for non-amd64 targets?
There was a problem hiding this comment.
I think cross-compilation is actively being worked on in OCaml, see https://discuss.ocaml.org/t/ocaml-cross-compiler/1494 . I don't think it works 100% yet :(
I think the only reliable way to build vpnkit for other targets would be to build on those targets. The current vpnkit CI builds binaries for macOS and Windows (for use in Docker Desktop). Which other targets do you need?
There was a problem hiding this comment.
Linux for armhf, arm64, s390x, and ppc64le
There was a problem hiding this comment.
@AkihiroSuda Btw, we don't have s390x and ppc64le releases for 18.09 anymore.
There was a problem hiding this comment.
@tonistiigi @thaJeztah does that mean that we can actually consider to drop s390x and ppc64le CI builds from Moby?
There was a problem hiding this comment.
I haven't been part of this discussion, but I don't see why moby would need to drop them from CI as moby is a source project to Docker 18.xx and future 19.xx products; whether Docker has official releases seems unrelated to whether those architectures are still validated in the moby upstream project during CI.
There was a problem hiding this comment.
Yes, no need to drop CI but if it becomes troublesome to support them for new features it is a data point to consider. For example, I think if we can't have these new binaries available on these platforms it shouldn't block this PR.
|
Alternative plan: can we just remove vpnkit/slirp4netns from |
|
Was about to suggest "dummy" aliases for the djs55/vpnkit image as a buildstage to make it pass on power/z/arm but then realized we're not using BuildKit yet :/
… On 25 Jan 2019, at 23:56, Tõnis Tiigi ***@***.***> wrote:
@tonistiigi commented on this pull request.
In Dockerfile:
> @@ -233,6 +238,10 @@ RUN cd /docker-py \
&& pip install paramiko==2.4.2 \
&& pip install yamllint==1.5.0 \
&& pip install -r test-requirements.txt
+COPY --from=rootlesskit /build/ /usr/local/bin/
+# VPNKit git b4c8b69e68f74c69a6e2fff696a3a196b061dde6 (1/5/2019)
+# FIXME: currently, this always install amd64 binary
Yes, no need to drop CI but if it becomes troublesome to support them for new features it is a data point to consider. For example, I think if we can't have these new binaries available on these platforms it shouldn't block this PR.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
We could still push dummy images to Docker Hub perhaps for these architectures (or conditionally download a tar.gz)? 🤔
… On 25 Jan 2019, at 23:56, Tõnis Tiigi ***@***.***> wrote:
@tonistiigi commented on this pull request.
In Dockerfile:
> @@ -233,6 +238,10 @@ RUN cd /docker-py \
&& pip install paramiko==2.4.2 \
&& pip install yamllint==1.5.0 \
&& pip install -r test-requirements.txt
+COPY --from=rootlesskit /build/ /usr/local/bin/
+# VPNKit git b4c8b69e68f74c69a6e2fff696a3a196b061dde6 (1/5/2019)
+# FIXME: currently, this always install amd64 binary
Yes, no need to drop CI but if it becomes troublesome to support them for new features it is a data point to consider. For example, I think if we can't have these new binaries available on these platforms it shouldn't block this PR.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Updated PR. Now user needs to be install either We should still include |
|
@thaJeztah You good? |
thaJeztah
left a comment
There was a problem hiding this comment.
Reviewing from my phone, so just from looking over the changes; left some comments/questions
I'm good to move this forward if those were errors on my side (and this is really cool to see arrive 👌😍🥳)
|
@AkihiroSuda are any packaging changes needed for this? /cc @seemethere |
…ode) Please refer to `docs/rootless.md`. TLDR: * Make sure `/etc/subuid` and `/etc/subgid` contain the entry for you * `dockerd-rootless.sh --experimental` * `docker -H unix://$XDG_RUNTIME_DIR/docker.sock run ...` Signed-off-by: Akihiro Suda <[email protected]>
|
Updated PR
I suggest adding |
Makes sense; if you have time; could you try opening a pull request in the https://github.com/docker/docker-ce-packaging repository? Perhaps the packaging team can work on it, but if you can prepare a PR, that may help speeding it up 🤗 (feel free to ping me if you need help/input on that one; I'll be on PTO for the next few days, but will try to catch up on notifications) |
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM! Thanks; this is really cool stuff 🥳
|
@AkihiroSuda Great work. 🎉
Can we use slirp4netns instead of VPNKit (asking for openSUSE when we package this). |
|
@cyphar I think the license for slirp4netns was the blocker for bundling it, but you can use it |
|
Right, because we use |
| flags.Var(&conf.NetworkConfig.DefaultAddressPools, "default-address-pool", "Default address pools for node specific local networks") | ||
|
|
||
| // Mostly users don't need to set this flag explicitly. | ||
| flags.BoolVar(&conf.Rootless, "rootless", rootless.RunningWithNonRootUsername(), "Enable rootless mode (experimental)") |
There was a problem hiding this comment.
For anyone looking to thread the needle, this line appears to be the cause of #39009. 👍 ❤️
- What I did
Allow running
dockerdin an unprivileged user namespace (rootless mode).Close #37375
No SETUID/SETCAP binary is required, except
newuidmapandnewgidmap.For Kubernetes integration, please refer to https://github.com/rootless-containers/usernetes .
This PR contains two commits, but the first one is same as #38038 (overlayfs in userns for Ubuntu).(Updated: #38083 is merged now)I'll rebase this PR when #38038 gets merged.
- How I did it
By using
user_namespaces(7),mount_namespaces(7),network_namespaces(7), and slirp4netns.Please refer to
docs/rootless.mdfor the details.- How to verify it
/etc/subuidand/etc/subgidcontain the entry for youdockerd-rootless.sh --experimentaldocker -H unix://$XDG_RUNTIME_DIR/docker.sock run ...Remarks:
sudo sh -c "echo 1 > /proc/sys/kernel/unprivileged_userns_clone".sudo modprobe ip_tables iptable_mangle iptable_nat iptable_filter.Restrictions:
vfsgraphdriver is supported. However, on Ubuntu and a few distros,overlay2andoverlayare also supported. Starting with Linux 4.18, we will be also able to implement FUSE snapshotters.docker top) and AppArmor are disabled at the moment. In future, Cgroups will be optionally available when delegation permission is configured on the host.
dockerdin rootless/rootfuldockerdis also possible, but not fully tested.- Description for the changelog
Allow running
dockerdin an unprivileged user namespace (rootless mode)- A picture of a cute animal (not mandatory but encouraged)
https://en.wikipedia.org/wiki/Little_penguin#/media/File:Eudyptula_minor_Bruny_1.jpg
Screenshot: