Merge pull request #3108 from aiordache/validate_dockerd_config

Document option for daemon config validation
This commit is contained in:
Sebastiaan van Stijn 2021-06-24 16:25:49 +02:00 committed by GitHub
commit 8e08b72450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -2560,6 +2560,7 @@ _docker_daemon() {
--raw-logs --raw-logs
--selinux-enabled --selinux-enabled
--userland-proxy=false --userland-proxy=false
--validate
--version -v --version -v
" "
local options_with_args=" local options_with_args="

View File

@ -2791,7 +2791,8 @@ __docker_subcommand() {
"($help)--tlsverify[Use TLS and verify the remote]" \ "($help)--tlsverify[Use TLS and verify the remote]" \
"($help)--userns-remap=[User/Group setting for user namespaces]:user\:group:->users-groups" \ "($help)--userns-remap=[User/Group setting for user namespaces]:user\:group:->users-groups" \
"($help)--userland-proxy[Use userland proxy for loopback traffic]" \ "($help)--userland-proxy[Use userland proxy for loopback traffic]" \
"($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" && ret=0 "($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" \
"($help)--validate[Validate daemon configuration and exit]" && ret=0
case $state in case $state in
(cluster-store) (cluster-store)

View File

@ -104,6 +104,7 @@ Options:
--userland-proxy Use userland proxy for loopback traffic (default true) --userland-proxy Use userland proxy for loopback traffic (default true)
--userland-proxy-path string Path to the userland proxy binary --userland-proxy-path string Path to the userland proxy binary
--userns-remap string User/Group setting for user namespaces --userns-remap string User/Group setting for user namespaces
--validate Validate daemon configuration and exit
-v, --version Print version information and quit -v, --version Print version information and quit
``` ```
@ -1334,6 +1335,25 @@ For example, the daemon fails to start if you set daemon labels
in the configuration file and also set daemon labels via the `--label` flag. in the configuration file and also set daemon labels via the `--label` flag.
Options that are not present in the file are ignored when the daemon starts. Options that are not present in the file are ignored when the daemon starts.
The `--validate` option allows to validate a configuration file without
starting the Docker daemon. A non-zero exit code is returned for invalid
configuration files.
```console
$ dockerd --validate --config-file=/tmp/valid-config.json
configuration OK
$ echo $?
0
$ dockerd --validate --config-file /tmp/invalid-config.json
unable to configure the Docker daemon with file /tmp/invalid-config.json: the following directives don't match any configuration option: unknown-option
$ echo $?
1
```
##### On Linux ##### On Linux
The default location of the configuration file on Linux is The default location of the configuration file on Linux is

View File

@ -75,6 +75,7 @@ dockerd - Enable daemon mode
[**--userland-proxy**[=*true*]] [**--userland-proxy**[=*true*]]
[**--userland-proxy-path**[=*""*]] [**--userland-proxy-path**[=*""*]]
[**--userns-remap**[=*default*]] [**--userns-remap**[=*default*]]
[**--validate**]
# DESCRIPTION # DESCRIPTION
**dockerd** is used for starting the Docker daemon (i.e., to command the daemon **dockerd** is used for starting the Docker daemon (i.e., to command the daemon
@ -411,6 +412,9 @@ unix://[/path/to/socket] to use.
daemon to lookup the user and group's subordinate ID ranges for use as the daemon to lookup the user and group's subordinate ID ranges for use as the
user namespace mappings for contained processes. user namespace mappings for contained processes.
**--validate**
Validate daemon configuration and exit.
# STORAGE DRIVER OPTIONS # STORAGE DRIVER OPTIONS
Docker uses storage backends (known as "graphdrivers" in the Docker Docker uses storage backends (known as "graphdrivers" in the Docker