From 4b633b4e90d3b84abdd9f4bcd133d7948042b24a Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Fri, 3 Nov 2023 14:20:54 +0100 Subject: [PATCH] docs: add default-network-opt daemon option Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- docs/reference/commandline/dockerd.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/reference/commandline/dockerd.md b/docs/reference/commandline/dockerd.md index 2549d5d95dc6..f1a248c466a7 100644 --- a/docs/reference/commandline/dockerd.md +++ b/docs/reference/commandline/dockerd.md @@ -46,6 +46,7 @@ Options: --default-gateway ip Container default gateway IPv4 address --default-gateway-v6 ip Container default gateway IPv6 address --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-shm-size bytes Default shm size for containers (default 64MiB) --default-ulimit ulimit Default ulimits for containers (default []) @@ -1017,6 +1018,7 @@ This is a full example of the allowed configuration options on Linux: "default-cgroupns-mode": "private", "default-gateway": "", "default-gateway-v6": "", + "default-network-opts": "", "default-runtime": "runc", "default-shm-size": "64M", "default-ulimits": { @@ -1134,6 +1136,7 @@ This is a full example of the allowed configuration options on Windows: "containerd-plugin-namespace": "docker-plugins", "data-root": "", "debug": true, + "default-network-opts": "", "default-runtime": "", "default-ulimits": {}, "dns": [], @@ -1279,3 +1282,25 @@ $ sudo dockerd \ --data-root=/var/lib/docker-bootstrap \ --exec-root=/var/run/docker-bootstrap ``` + +### Default network options + +The `--default-network-opt` flag, and the equivalent `default-network-opts` key +in the configuratio file, lets you specify custom default options for custom +networks. + +This option accepts a value with the 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 +``` + +New networks that you create inherit the specified options by default. + +```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"} +```