-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Allow running dockerd as a non-root user (Rootless mode) #38050
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 |
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.
Not too familiar with all the requirements to make this work, but had a quick glance over, and left some comments/suggestions 🤗
addressed comments |
Updated PR. Now user needs to be install either We should still include |
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.
LGTM
@thaJeztah You good? |
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.
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 <suda.akihiro@lab.ntt.co.jp>
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) |
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.
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 |
@@ -46,5 +49,7 @@ func installConfigFlags(conf *config.Config, flags *pflag.FlagSet) { | |||
flags.BoolVar(&conf.NoNewPrivileges, "no-new-privileges", false, "Set no-new-privileges by default for new containers") | |||
flags.StringVar(&conf.IpcMode, "default-ipc-mode", config.DefaultIpcMode, `Default mode for containers ipc ("shareable" | "private")`) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For anyone looking to thread the needle, this line appears to be the cause of #39009. 👍 ❤️
- What I did
Allow running
dockerd
in an unprivileged user namespace (rootless mode).Close #37375
No SETUID/SETCAP binary is required, except
newuidmap
andnewgidmap
.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.md
for the details.- How to verify it
/etc/subuid
and/etc/subgid
contain the entry for youdockerd-rootless.sh --experimental
docker -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:
vfs
graphdriver is supported. However, on Ubuntu and a few distros,overlay2
andoverlay
are 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.
dockerd
in rootless/rootfuldockerd
is also possible, but not fully tested.- Description for the changelog
Allow running
dockerd
in 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: