moby--moby/cmd/dockerd
Sebastiaan van Stijn aaa1392279
Pass log-level to containerd
dockerd allows the `--log-level` to be specified, but this log-level
was not forwarded to the containerd process.

This patch sets containerd's log-level to the same as dockerd if a
custom level is provided.

Now that `--log-level` is also passed to containerd, the default "info"
is removed, so that containerd's default (or the level configured in containerd.toml)
is still used if no log-level is set.

Before this change:

containerd would always be started without a log-level set (only the level that's configured in `containerd.toml`);

```
root      1014  2.5  2.1 496484 43468 pts/0    Sl+  12:23   0:00 dockerd
root      1023  1.2  1.1 681768 23832 ?        Ssl  12:23   0:00  \_ docker-containerd --config /var/run/docker/containerd/containerd.toml
```

After this change:

when running `dockerd` without options (same as current);

```
root      1014  2.5  2.1 496484 43468 pts/0    Sl+  12:23   0:00 dockerd
root      1023  1.2  1.1 681768 23832 ?        Ssl  12:23   0:00  \_ docker-containerd --config /var/run/docker/containerd/containerd.toml
```

when running `dockerd --debug`:

```
root       600  0.8  2.1 512876 43180 pts/0    Sl+  12:20   0:00 dockerd --debug
root       608  0.6  1.1 624428 23672 ?        Ssl  12:20   0:00  \_ docker-containerd --config /var/run/docker/containerd/containerd.toml --log-level debug
```

when running `dockerd --log-level=panic`

```
root       747  0.6  2.1 496548 43996 pts/0    Sl+  12:21   0:00 dockerd --log-level=panic
root       755  0.7  1.1 550696 24100 ?        Ssl  12:21   0:00  \_ docker-containerd --config /var/run/docker/containerd/containerd.toml --log-level panic
```

combining `--debug` and `--log-level` (`--debug` takes precedence):

```
root       880  2.7  2.1 634692 43336 pts/0    Sl+  12:23   0:00 dockerd --debug --log-level=panic
root       888  1.0  1.1 616232 23652 ?        Ssl  12:23   0:00  \_ docker-containerd --config /var/run/docker/containerd/containerd.toml --log-level debug
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-09 15:38:08 +02:00
..
hack Add canonical import comment 2018-02-05 16:51:57 -05:00
README.md Fix readme doc for dockerd 2016-09-01 14:47:51 +08:00
config.go Fix "--node-generic-resource" singular/plural 2018-01-26 13:53:13 -08:00
config_common_unix.go Remove solaris build tag and `contrib/mkimage/solaris 2017-11-02 00:01:46 +00:00
config_unix.go Various code-cleanup 2018-05-23 17:50:54 +02:00
config_unix_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
config_windows.go Update libcontainerd to use containerd 1.0 2017-10-20 07:11:37 -07:00
daemon.go builder: export build cache records 2018-06-10 10:05:27 -07:00
daemon_freebsd.go Windows: Wait for OOBE to prevent crashing during host update 2017-02-15 14:01:54 -08:00
daemon_linux.go Use go-systemd const instead of magic string in Linux version of dockerd 2018-05-23 19:06:34 +02:00
daemon_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
daemon_unix.go Pass log-level to containerd 2018-07-09 15:38:08 +02:00
daemon_unix_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
daemon_windows.go Merge pull request #35253 from Microsoft/jjh/startuplogging 2017-10-23 18:43:41 +02:00
docker.go Use Cobra built-in --version feature 2018-05-19 03:15:08 +02:00
docker_unix.go Split daemon service code to _windows file 2018-03-21 12:57:53 +01:00
docker_windows.go Split daemon service code to _windows file 2018-03-21 12:57:53 +01:00
metrics.go Various code-cleanup 2018-05-23 17:50:54 +02:00
options.go Use Cobra built-in --version feature 2018-05-19 03:15:08 +02:00
options_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
service_unsupported.go Split daemon service code to _windows file 2018-03-21 12:57:53 +01:00
service_windows.go Update logrus to v1.0.1 2017-07-31 13:16:46 -07:00

README.md

docker.go contains Docker daemon's main function.

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