mirror of https://github.com/docker/cli.git
Merge pull request #4639 from dvdksn/backport_dockerd-default-nw-opt
[24.0 Backport] docs: add default-network-opt daemon option
This commit is contained in:
commit
48ec4f339e
|
@ -46,6 +46,7 @@ Options:
|
||||||
--default-gateway ip Container default gateway IPv4 address
|
--default-gateway ip Container default gateway IPv4 address
|
||||||
--default-gateway-v6 ip Container default gateway IPv6 address
|
--default-gateway-v6 ip Container default gateway IPv6 address
|
||||||
--default-ipc-mode string Default mode for containers ipc ("shareable" | "private") (default "private")
|
--default-ipc-mode string Default mode for containers ipc ("shareable" | "private") (default "private")
|
||||||
|
--default-network-opt mapmap Default network options (default map[])
|
||||||
--default-runtime string Default OCI runtime for containers (default "runc")
|
--default-runtime string Default OCI runtime for containers (default "runc")
|
||||||
--default-shm-size bytes Default shm size for containers (default 64MiB)
|
--default-shm-size bytes Default shm size for containers (default 64MiB)
|
||||||
--default-ulimit ulimit Default ulimits for containers (default [])
|
--default-ulimit ulimit Default ulimits for containers (default [])
|
||||||
|
@ -1449,6 +1450,7 @@ This is a full example of the allowed configuration options on Linux:
|
||||||
"default-cgroupns-mode": "private",
|
"default-cgroupns-mode": "private",
|
||||||
"default-gateway": "",
|
"default-gateway": "",
|
||||||
"default-gateway-v6": "",
|
"default-gateway-v6": "",
|
||||||
|
"default-network-opts": {},
|
||||||
"default-runtime": "runc",
|
"default-runtime": "runc",
|
||||||
"default-shm-size": "64M",
|
"default-shm-size": "64M",
|
||||||
"default-ulimits": {
|
"default-ulimits": {
|
||||||
|
@ -1566,6 +1568,7 @@ This is a full example of the allowed configuration options on Windows:
|
||||||
"containerd-plugin-namespace": "docker-plugins",
|
"containerd-plugin-namespace": "docker-plugins",
|
||||||
"data-root": "",
|
"data-root": "",
|
||||||
"debug": true,
|
"debug": true,
|
||||||
|
"default-network-opts": {},
|
||||||
"default-runtime": "",
|
"default-runtime": "",
|
||||||
"default-ulimits": {},
|
"default-ulimits": {},
|
||||||
"dns": [],
|
"dns": [],
|
||||||
|
@ -1711,3 +1714,50 @@ $ sudo dockerd \
|
||||||
--data-root=/var/lib/docker-bootstrap \
|
--data-root=/var/lib/docker-bootstrap \
|
||||||
--exec-root=/var/run/docker-bootstrap
|
--exec-root=/var/run/docker-bootstrap
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Default network options
|
||||||
|
|
||||||
|
The `default-network-opts` key in the `daemon.json` configuration file, and the
|
||||||
|
equivalent `--default-network-opt` CLI flag, let you specify default values for
|
||||||
|
driver network driver options for new networks.
|
||||||
|
|
||||||
|
The following example shows how to configure options for the `bridge` driver
|
||||||
|
using the `daemon.json` file.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"default-network-opts": {
|
||||||
|
"bridge": {
|
||||||
|
"com.docker.network.bridge.host_binding_ipv4": "127.0.0.1",
|
||||||
|
"com.docker.network.bridge.mtu": "1234"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This example uses the `bridge` network driver. Refer to the
|
||||||
|
[bridge network driver page](https://docs.docker.com/network/drivers/bridge/#options)
|
||||||
|
for an overview of available driver options.
|
||||||
|
|
||||||
|
After changing the configuration and restarting the daemon, new networks that
|
||||||
|
you create use these option configurations as defaults.
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker network create mynet
|
||||||
|
$ docker network inspect mynet --format "{{json .Options}}"
|
||||||
|
{"com.docker.network.bridge.host_binding_ipv4":"127.0.0.1","com.docker.network.bridge.mtu":"1234"}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that changing this daemon configuration doesn't affect pre-existing
|
||||||
|
networks.
|
||||||
|
|
||||||
|
Using the `--default-network-opt` CLI flag is useful for testing and debugging
|
||||||
|
purposes, but you should prefer using the `daemon.json` file for persistent
|
||||||
|
daemon configuration. The CLI flag expects a value with the following format:
|
||||||
|
`driver=opt=value`, for example:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ sudo dockerd \
|
||||||
|
--default-network-opt bridge=com.docker.network.bridge.host_binding_ipv4=127.0.0.1 \
|
||||||
|
--default-network-opt bridge=com.docker.network.bridge.mtu=1234
|
||||||
|
```
|
||||||
|
|
|
@ -20,6 +20,7 @@ dockerd - Enable daemon mode
|
||||||
[**--default-gateway**[=*DEFAULT-GATEWAY*]]
|
[**--default-gateway**[=*DEFAULT-GATEWAY*]]
|
||||||
[**--default-gateway-v6**[=*DEFAULT-GATEWAY-V6*]]
|
[**--default-gateway-v6**[=*DEFAULT-GATEWAY-V6*]]
|
||||||
[**--default-address-pool**[=*DEFAULT-ADDRESS-POOL*]]
|
[**--default-address-pool**[=*DEFAULT-ADDRESS-POOL*]]
|
||||||
|
[**--default-network-opt**[=*DRIVER=OPT=VALUE*]]
|
||||||
[**--default-runtime**[=*runc*]]
|
[**--default-runtime**[=*runc*]]
|
||||||
[**--default-ipc-mode**=*MODE*]
|
[**--default-ipc-mode**=*MODE*]
|
||||||
[**--default-shm-size**[=*64MiB*]]
|
[**--default-shm-size**[=*64MiB*]]
|
||||||
|
@ -186,6 +187,9 @@ $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-ru
|
||||||
Example: base=172.30.0.0/16,size=24 will set the default
|
Example: base=172.30.0.0/16,size=24 will set the default
|
||||||
address pools for the selected scope networks to {172.30.[0-255].0/24}
|
address pools for the selected scope networks to {172.30.[0-255].0/24}
|
||||||
|
|
||||||
|
**--default-network-opt**=*DRIVER=OPT=VALUE*
|
||||||
|
Default network driver options
|
||||||
|
|
||||||
**--default-runtime**=*"runtime"*
|
**--default-runtime**=*"runtime"*
|
||||||
Set default runtime if there're more than one specified by **--add-runtime**.
|
Set default runtime if there're more than one specified by **--add-runtime**.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue