1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/cmd/dockerd
Akihiro Suda 8493fb18ae
dockerd: fix rootless detection (alternative to #39024)
The `--rootless` flag had a couple of issues:
* #38702: euid=0, $USER="root" but no access to cgroup ("rootful" Docker in rootless Docker)
* #39009: euid=0 but $USER="docker" (rootful boot2docker)

To fix #38702, XDG dirs are ignored as in rootful Docker, unless the
dockerd is directly running under RootlessKit namespaces.

RootlessKit detection is implemented by checking whether `$ROOTLESSKIT_STATE_DIR` is set.

To fix #39009, the non-robust `$USER` check is now completely removed.

The entire logic can be illustrated as follows:

```
withRootlessKit := getenv("ROOTLESSKIT_STATE_DIR")
rootlessMode := withRootlessKit || cliFlag("--rootless")
honorXDG := withRootlessKit
useRootlessKitDockerProxy := withRootlessKit
removeCgroupSpec := rootlessMode
adjustOOMScoreAdj := rootlessMode
```

Close #39024
Fix #38702 #39009

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
(cherry picked from commit 3518383ed9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-05-13 15:31:31 -07:00
..
hack
config.go Remove the rest of v1 manifest support 2019-03-02 10:46:37 -08:00
config_common_unix.go dockerd: fix rootless detection (alternative to #39024) 2019-05-13 15:31:31 -07:00
config_unix.go dockerd: fix rootless detection (alternative to #39024) 2019-05-13 15:31:31 -07:00
config_unix_test.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
config_windows.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
daemon.go dockerd: fix rootless detection (alternative to #39024) 2019-05-13 15:31:31 -07:00
daemon_freebsd.go
daemon_linux.go
daemon_test.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
daemon_unix.go dockerd: fix rootless detection (alternative to #39024) 2019-05-13 15:31:31 -07:00
daemon_unix_test.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
daemon_windows.go fix containerd WaitTimeout 2019-04-08 18:44:14 +09:00
docker.go dockerd: fix rootless detection (alternative to #39024) 2019-05-13 15:31:31 -07:00
docker_unix.go Windows:Add ETW logging hook 2019-03-12 18:41:55 -07:00
docker_windows.go Windows:Add ETW logging hook 2019-03-12 18:41:55 -07:00
metrics.go
options.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
options_test.go
README.md
service_unsupported.go
service_windows.go Properly type handles to prevent overflows 2018-10-10 16:46:37 -07:00

docker.go contains Docker daemon's main function.

This file provides first line CLI argument parsing and environment variable setting.