From 7811c442d6ac90d6e959ccf4b7b133e80ab6eb90 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 12 Sep 2024 19:24:29 +0200 Subject: [PATCH 1/6] man: update dockerd man-page to include --feature flag commit f13c08246d93dd5aae200d5881a3a374e6cac876 introduced this flag, but did not yet update the manpage. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 610f9157f51b3c23fb364d8467f55b2c788301d9) Signed-off-by: Sebastiaan van Stijn --- man/dockerd.8.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/man/dockerd.8.md b/man/dockerd.8.md index 2a769e5671dc..47391497c4c1 100644 --- a/man/dockerd.8.md +++ b/man/dockerd.8.md @@ -31,6 +31,7 @@ dockerd - Enable daemon mode [**--exec-opt**[=*[]*]] [**--exec-root**[=*/var/run/docker*]] [**--experimental**[=**false**]] +[**--feature**[=*NAME*=**true**|**false**] [**--fixed-cidr**[=*FIXED-CIDR*]] [**--fixed-cidr-v6**[=*FIXED-CIDR-V6*]] [**-G**|**--group**[=*docker*]] @@ -222,6 +223,14 @@ $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-ru **--experimental**="" Enable the daemon experimental features. +**--feature**=*NAME*=**true**|**false** + Enable or disable feature feature in the daemon. This option corresponds + with the "features" field in the daemon.json configuration file. Using + both the command-line option and the "features" field in the configuration + file produces an error. The feature option can be specified multiple times + to configure multiple features. + Usage example: `--feature containerd-snapshotter=true` + **--fixed-cidr**="" IPv4 subnet for fixed IPs (e.g., 10.20.0.0/16); this subnet must be nested in the bridge subnet (which is defined by \-b or \-\-bip). From bc87ef962a343f9cf3c2092b0228267d4f55958e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Sep 2024 09:57:39 +0200 Subject: [PATCH 2/6] man: fix duplicate word in --feature flag description Signed-off-by: Sebastiaan van Stijn (cherry picked from commit fb056d2cebfa1e2d4a78ff3614df39e5af1a2ecf) Signed-off-by: Sebastiaan van Stijn --- man/dockerd.8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/dockerd.8.md b/man/dockerd.8.md index 47391497c4c1..ebcb3691be7a 100644 --- a/man/dockerd.8.md +++ b/man/dockerd.8.md @@ -224,7 +224,7 @@ $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-ru Enable the daemon experimental features. **--feature**=*NAME*=**true**|**false** - Enable or disable feature feature in the daemon. This option corresponds + Enable or disable a feature in the daemon. This option corresponds with the "features" field in the daemon.json configuration file. Using both the command-line option and the "features" field in the configuration file produces an error. The feature option can be specified multiple times From db7a014d37504cb96e0dde54ecdecf4cd4088425 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Sep 2024 10:26:20 +0200 Subject: [PATCH 3/6] man: dockerd: value is optional for --feature flag The --feature flag allows the boolean value to be omitted. If only a name is provided, the default is "true". Signed-off-by: Sebastiaan van Stijn (cherry picked from commit a357db0aba22d669e892c13606573046e8ba01e1) Signed-off-by: Sebastiaan van Stijn --- man/dockerd.8.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/dockerd.8.md b/man/dockerd.8.md index ebcb3691be7a..c93f809991db 100644 --- a/man/dockerd.8.md +++ b/man/dockerd.8.md @@ -31,7 +31,7 @@ dockerd - Enable daemon mode [**--exec-opt**[=*[]*]] [**--exec-root**[=*/var/run/docker*]] [**--experimental**[=**false**]] -[**--feature**[=*NAME*=**true**|**false**] +[**--feature**[=*NAME*[=**true**|**false**]] [**--fixed-cidr**[=*FIXED-CIDR*]] [**--fixed-cidr-v6**[=*FIXED-CIDR-V6*]] [**-G**|**--group**[=*docker*]] @@ -223,13 +223,13 @@ $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-ru **--experimental**="" Enable the daemon experimental features. -**--feature**=*NAME*=**true**|**false** +**--feature**=*NAME*[=**true**|**false**] Enable or disable a feature in the daemon. This option corresponds with the "features" field in the daemon.json configuration file. Using both the command-line option and the "features" field in the configuration file produces an error. The feature option can be specified multiple times to configure multiple features. - Usage example: `--feature containerd-snapshotter=true` + Usage example: `--feature containerd-snapshotter` or `--feature containerd-snapshotter=true`. **--fixed-cidr**="" IPv4 subnet for fixed IPs (e.g., 10.20.0.0/16); this subnet must be nested in From 245f79ff571d777a27f9e0c055da04502e6a0ff6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Sep 2024 11:28:41 +0200 Subject: [PATCH 4/6] docs/reference: dockerd: add docs for --feature option Signed-off-by: Sebastiaan van Stijn (cherry picked from commit a42ca1148d5a7ab503ad081c3c3d59dcf55f0330) Signed-off-by: Sebastiaan van Stijn --- docs/reference/dockerd.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/reference/dockerd.md b/docs/reference/dockerd.md index c13c20a86495..a6b6464aeb6e 100644 --- a/docs/reference/dockerd.md +++ b/docs/reference/dockerd.md @@ -57,6 +57,7 @@ Options: --exec-opt list Runtime execution options --exec-root string Root directory for execution state files (default "/var/run/docker") --experimental Enable experimental features + --feature map Enable feature in the daemon --fixed-cidr string IPv4 subnet for fixed IPs --fixed-cidr-v6 string IPv6 subnet for fixed IPs -G, --group string Group for the unix socket (default "docker") @@ -971,6 +972,36 @@ Example of usage: } ``` +### Enable feature in the daemon (--feature) + +The `--feature` option lets you enable or disable a feature in the daemon. +This option corresponds with the "features" field in the [daemon.json configuration file](#daemon-configuration-file). +Features should only be configured either through the `--feature` command line +option or through the "features" field in the configuration file; using both +the command-line option and the "features" field in the configuration +file produces an error. The feature option can be specified multiple times +to configure multiple features. The `--feature` option accepts a name and +optional boolean value. When omitting the value, the default is `true`. + +The following example runs the daemon with the `cdi` and `containerd-snapshotter` +features enabled. The `cdi` option is provided with a value; + +```console +$ dockerd --feature cdi=true --feature containerd-snapshotter +``` + +The following example is the equivalent using the `daemon.json` configuration +file; + +```json +{ + "features": { + "cdi": true, + "containerd-snapshotter": true + } +} +``` + ### Daemon configuration file The `--config-file` option allows you to set any configuration option @@ -1065,7 +1096,10 @@ The following is a full example of the allowed configuration options on Linux: "exec-opts": [], "exec-root": "", "experimental": false, - "features": {}, + "features": { + "cdi": true, + "containerd-snapshotter": true + }, "fixed-cidr": "", "fixed-cidr-v6": "", "group": "", From 7c72283b3744bcfd38313dd3dcbbab0c2cbcd3d7 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Sep 2024 12:41:23 +0200 Subject: [PATCH 5/6] man: dockerd: add description for --log-format option This option was added in a08abec9f8d59eaa44c375900e254384a68c5a31, as part of Docker v25.0, but did not update the docs and manpage. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 9ae514fdc7a39f0af23cd25f8c38e714a9d0e6ae) Signed-off-by: Sebastiaan van Stijn --- man/dockerd.8.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/dockerd.8.md b/man/dockerd.8.md index c93f809991db..4f2d4b809b30 100644 --- a/man/dockerd.8.md +++ b/man/dockerd.8.md @@ -53,6 +53,7 @@ dockerd - Enable daemon mode [**--label**[=*[]*]] [**--live-restore**[=**false**]] [**--log-driver**[=*json-file*]] +[**--log-format**="*text*|*json*"] [**--log-opt**[=*map[]*]] [**--mtu**[=*0*]] [**--max-concurrent-downloads**[=*3*]] @@ -333,6 +334,9 @@ unix://[/path/to/socket] to use. Default driver for container logs. Default is **json-file**. **Warning**: **docker logs** command works only for **json-file** logging driver. +**--log-format**="*text*|*json*" + Set the format for logs produced by the daemon. Default is "text". + **--log-opt**=[] Logging driver specific options. From 84d4a5ef11ac4a56879dd1805d5b33174281824e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Sep 2024 13:16:13 +0200 Subject: [PATCH 6/6] docs: dockerd: add documentation for --log-format option Signed-off-by: Sebastiaan van Stijn (cherry picked from commit baceb4b1586f38b9d6c031ab0a696f32c52852f3) Signed-off-by: Sebastiaan van Stijn --- docs/reference/dockerd.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/reference/dockerd.md b/docs/reference/dockerd.md index a6b6464aeb6e..bb603c9b386e 100644 --- a/docs/reference/dockerd.md +++ b/docs/reference/dockerd.md @@ -80,6 +80,7 @@ Options: --label list Set key=value labels to the daemon --live-restore Enable live restore of docker when containers are still running --log-driver string Default driver for container logs (default "json-file") + --log-format string Set the logging format ("text"|"json") (default "text") -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info") --log-opt map Default log driver options for containers (default map[]) --max-concurrent-downloads int Set the max concurrent downloads (default 3) @@ -891,6 +892,33 @@ Alternatively, you can set custom locations for CDI specifications using the When CDI is enabled for a daemon, you can view the configured CDI specification directories using the `docker info` command. +#### Daemon logging format + +The `--log-format` option or "log-format" option in the [daemon configuration file](#daemon-configuration-file) +lets you set the format for logs produced by the daemon. The logging format should +only be configured either through the `--log-format` command line option or +through the "log-format" field in the configuration file; using both +the command-line option and the "log-format" field in the configuration +file produces an error. If this option is not set, the default is "text". + +The following example configures the daemon through the `--log-format` command +line option to use `json` formatted logs; + +```console +$ dockerd --log-format=json +# ... +{"level":"info","msg":"API listen on /var/run/docker.sock","time":"2024-09-16T11:06:08.558145428Z"} +``` + +The following example shows a `daemon.json` configuration file with the +"log-format" set; + +```json +{ + "log-format": "json" +} +``` + ### Miscellaneous options IP masquerading uses address translation to allow containers without a public @@ -1123,6 +1151,7 @@ The following is a full example of the allowed configuration options on Linux: "labels": [], "live-restore": true, "log-driver": "json-file", + "log-format": "text", "log-level": "", "log-opts": { "cache-disabled": "false", @@ -1217,6 +1246,7 @@ The following is a full example of the allowed configuration options on Windows: "insecure-registries": [], "labels": [], "log-driver": "", + "log-format": "text", "log-level": "", "max-concurrent-downloads": 3, "max-concurrent-uploads": 5,