github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/dockerd.md (about) 1 --- 2 title: "dockerd" 3 description: "The daemon command description and usage" 4 keywords: "container, daemon, runtime" 5 aliases: 6 - /engine/reference/commandline/daemon/ 7 --- 8 9 <!-- This file is maintained within the docker/cli GitHub 10 repository at https://github.com/khulnasoft/cli/. Make all 11 pull requests against that repo. If you see this file in 12 another repository, consider it read-only there, as it will 13 periodically be overwritten by the definitive file. Pull 14 requests which include edits to this file in other repositories 15 will be rejected. 16 --> 17 18 # daemon 19 20 ```markdown 21 Usage: dockerd [OPTIONS] 22 23 A self-sufficient runtime for containers. 24 25 Options: 26 --add-runtime runtime Register an additional OCI compatible runtime (default []) 27 --allow-nondistributable-artifacts list Allow push of nondistributable artifacts to registry 28 --api-cors-header string Set CORS headers in the Engine API 29 --authorization-plugin list Authorization plugins to load 30 --bip string Specify network bridge IP 31 -b, --bridge string Attach containers to a network bridge 32 --cdi-spec-dir list CDI specification directories to use 33 --cgroup-parent string Set parent cgroup for all containers 34 --config-file string Daemon configuration file (default "/etc/docker/daemon.json") 35 --containerd string containerd grpc address 36 --containerd-namespace string Containerd namespace to use (default "moby") 37 --containerd-plugins-namespace string Containerd namespace to use for plugins (default "plugins.moby") 38 --cpu-rt-period int Limit the CPU real-time period in microseconds for the 39 parent cgroup for all containers (not supported with cgroups v2) 40 --cpu-rt-runtime int Limit the CPU real-time runtime in microseconds for the 41 parent cgroup for all containers (not supported with cgroups v2) 42 --cri-containerd start containerd with cri 43 --data-root string Root directory of persistent Docker state (default "/var/lib/docker") 44 -D, --debug Enable debug mode 45 --default-address-pool pool-options Default address pools for node specific local networks 46 --default-cgroupns-mode string Default mode for containers cgroup namespace ("host" | "private") (default "private") 47 --default-gateway ip Container default gateway IPv4 address 48 --default-gateway-v6 ip Container default gateway IPv6 address 49 --default-ipc-mode string Default mode for containers ipc ("shareable" | "private") (default "private") 50 --default-network-opt mapmap Default network options (default map[]) 51 --default-runtime string Default OCI runtime for containers (default "runc") 52 --default-shm-size bytes Default shm size for containers (default 64MiB) 53 --default-ulimit ulimit Default ulimits for containers (default []) 54 --dns list DNS server to use 55 --dns-opt list DNS options to use 56 --dns-search list DNS search domains to use 57 --exec-opt list Runtime execution options 58 --exec-root string Root directory for execution state files (default "/var/run/docker") 59 --experimental Enable experimental features 60 --fixed-cidr string IPv4 subnet for fixed IPs 61 --fixed-cidr-v6 string IPv6 subnet for fixed IPs 62 -G, --group string Group for the unix socket (default "docker") 63 --help Print usage 64 -H, --host list Daemon socket(s) to connect to 65 --host-gateway-ip ip IP address that the special 'host-gateway' string in --add-host resolves to. 66 Defaults to the IP address of the default bridge 67 --http-proxy string HTTP proxy URL to use for outgoing traffic 68 --https-proxy string HTTPS proxy URL to use for outgoing traffic 69 --icc Enable inter-container communication (default true) 70 --init Run an init in the container to forward signals and reap processes 71 --init-path string Path to the docker-init binary 72 --insecure-registry list Enable insecure registry communication 73 --ip ip Default IP when binding container ports (default 0.0.0.0) 74 --ip-forward Enable net.ipv4.ip_forward (default true) 75 --ip-masq Enable IP masquerading (default true) 76 --ip6tables Enable addition of ip6tables rules (experimental) 77 --iptables Enable addition of iptables rules (default true) 78 --ipv6 Enable IPv6 networking 79 --label list Set key=value labels to the daemon 80 --live-restore Enable live restore of docker when containers are still running 81 --log-driver string Default driver for container logs (default "json-file") 82 -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info") 83 --log-opt map Default log driver options for containers (default map[]) 84 --max-concurrent-downloads int Set the max concurrent downloads (default 3) 85 --max-concurrent-uploads int Set the max concurrent uploads (default 5) 86 --max-download-attempts int Set the max download attempts for each pull (default 5) 87 --metrics-addr string Set default address and port to serve the metrics api on 88 --mtu int Set the containers network MTU (default 1500) 89 --network-control-plane-mtu int Network Control plane MTU (default 1500) 90 --no-new-privileges Set no-new-privileges by default for new containers 91 --no-proxy string Comma-separated list of hosts or IP addresses for which the proxy is skipped 92 --node-generic-resource list Advertise user-defined resource 93 --oom-score-adjust int Set the oom_score_adj for the daemon 94 -p, --pidfile string Path to use for daemon PID file (default "/var/run/docker.pid") 95 --raw-logs Full timestamps without ANSI coloring 96 --registry-mirror list Preferred registry mirror 97 --rootless Enable rootless mode; typically used with RootlessKit 98 --seccomp-profile string Path to seccomp profile. Use "unconfined" to disable the default seccomp profile (default "builtin") 99 --selinux-enabled Enable selinux support 100 --shutdown-timeout int Set the default shutdown timeout (default 15) 101 -s, --storage-driver string Storage driver to use 102 --storage-opt list Storage driver options 103 --swarm-default-advertise-addr string Set default address or interface for swarm advertised address 104 --tls Use TLS; implied by --tlsverify 105 --tlscacert string Trust certs signed only by this CA (default "~/.docker/ca.pem") 106 --tlscert string Path to TLS certificate file (default "~/.docker/cert.pem") 107 --tlskey string Path to TLS key file (default "~/.docker/key.pem") 108 --tlsverify Use TLS and verify the remote 109 --userland-proxy Use userland proxy for loopback traffic (default true) 110 --userland-proxy-path string Path to the userland proxy binary 111 --userns-remap string User/Group setting for user namespaces 112 --validate Validate daemon configuration and exit 113 -v, --version Print version information and quit 114 ``` 115 116 Options with [] may be specified multiple times. 117 118 ## Description 119 120 `dockerd` is the persistent process that manages containers. Docker 121 uses different binaries for the daemon and client. To run the daemon you 122 type `dockerd`. 123 124 To run the daemon with debug output, use `dockerd --debug` or add `"debug": true` 125 to [the `daemon.json` file](#daemon-configuration-file). 126 127 > **Enabling experimental features** 128 > 129 > Enable experimental features by starting `dockerd` with the `--experimental` 130 > flag or adding `"experimental": true` to the `daemon.json` file. 131 132 ### Environment variables 133 134 The following list of environment variables are supported by the `dockerd` daemon. 135 Some of these environment variables are supported both by the Docker Daemon and 136 the `docker` CLI. Refer to [Environment variables](https://docs.docker.com/engine/reference/commandline/cli/#environment-variables) 137 in the CLI section to learn about environment variables supported by the 138 `docker` CLI. 139 140 | Variable | Description | 141 | :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 142 | `DOCKER_CERT_PATH` | Location of your authentication keys. This variable is used both by the [`docker` CLI](https://docs.docker.com/engine/reference/commandline/cli/) and the `dockerd` daemon. | 143 | `DOCKER_DRIVER` | The storage driver to use. | 144 | `DOCKER_RAMDISK` | If set this disables `pivot_root`. | 145 | `DOCKER_TLS_VERIFY` | When set Docker uses TLS and verifies the remote. This variable is used both by the [`docker` CLI](https://docs.docker.com/engine/reference/commandline/cli/) and the `dockerd` daemon. | 146 | `DOCKER_TMPDIR` | Location for temporary files created by the daemon. | 147 | `HTTP_PROXY` | Proxy URL for HTTP requests unless overridden by NoProxy. See the [Go specification](https://pkg.go.dev/golang.org/x/net/http/httpproxy#Config) for details. | 148 | `HTTPS_PROXY` | Proxy URL for HTTPS requests unless overridden by NoProxy. See the [Go specification](https://pkg.go.dev/golang.org/x/net/http/httpproxy#Config) for details. | 149 | `MOBY_DISABLE_PIGZ` | Disables the use of [`unpigz`](https://linux.die.net/man/1/pigz) to decompress layers in parallel when pulling images, even if it is installed. | 150 | `NO_PROXY` | Comma-separated values specifying hosts that should be excluded from proxying. See the [Go specification](https://pkg.go.dev/golang.org/x/net/http/httpproxy#Config) for details. | 151 152 ## Examples 153 154 ### Proxy configuration 155 156 > **Note** 157 > 158 > Refer to the [Docker Desktop manual](https://docs.docker.com/desktop/networking/#httphttps-proxy-support) 159 > if you are running [Docker Desktop](https://docs.docker.com/desktop/). 160 161 If you are behind an HTTP proxy server, for example in corporate settings, 162 you may have to configure the Docker daemon to use the proxy server for 163 operations such as pulling and pushing images. The daemon can be configured 164 in three ways: 165 166 1. Using environment variables (`HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`). 167 2. Using the `http-proxy`, `https-proxy`, and `no-proxy` fields in the 168 [daemon configuration file](#daemon-configuration-file) (Docker Engine version 23.0 or later). 169 3. Using the `--http-proxy`, `--https-proxy`, and `--no-proxy` command-line 170 options. (Docker Engine version 23.0 or later). 171 172 The command-line and configuration file options take precedence over environment 173 variables. Refer to [control and configure Docker with systemd](https://docs.docker.com/config/daemon/systemd/#httphttps-proxy) 174 to set these environment variables on a host using `systemd`. 175 176 ### Daemon socket option 177 178 The Docker daemon can listen for [Docker Engine API](https://docs.docker.com/engine/api/) 179 requests via three different types of Socket: `unix`, `tcp`, and `fd`. 180 181 By default, a `unix` domain socket (or IPC socket) is created at 182 `/var/run/docker.sock`, requiring either `root` permission, or `docker` group 183 membership. 184 185 If you need to access the Docker daemon remotely, you need to enable the tcp 186 Socket. When using a TCP socket, the Docker daemon provides un-encrypted and 187 un-authenticated direct access to the Docker daemon by default. You should secure 188 the daemon either using the [built in HTTPS encrypted socket](https://docs.docker.com/engine/security/protect-access/), 189 or by putting a secure web proxy in front of it. You can listen on port `2375` on all 190 network interfaces with `-H tcp://0.0.0.0:2375`, or on a particular network 191 interface using its IP address: `-H tcp://192.168.59.103:2375`. It is 192 conventional to use port `2375` for un-encrypted, and port `2376` for encrypted 193 communication with the daemon. 194 195 > **Note** 196 > 197 > If you're using an HTTPS encrypted socket, keep in mind that only 198 > TLS version 1.0 and higher is supported. Protocols SSLv3 and below are not 199 > supported for security reasons. 200 201 On systemd based systems, you can communicate with the daemon via 202 [systemd socket activation](https://0pointer.de/blog/projects/socket-activation.html), 203 with `dockerd -H fd://`. Using `fd://` works for most setups, but 204 you can also specify individual sockets: `dockerd -H fd://3`. If the 205 specified socket activated files aren't found, the daemon exits. You can 206 find examples of using systemd socket activation with Docker and systemd in the 207 [Docker source tree](https://github.com/docker/docker/tree/master/contrib/init/systemd/). 208 209 You can configure the Docker daemon to listen to multiple sockets at the same 210 time using multiple `-H` options: 211 212 The example below runs the daemon listening on the default Unix socket, and 213 on 2 specific IP addresses on this host: 214 215 ```console 216 $ sudo dockerd -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2 217 ``` 218 219 The Docker client honors the `DOCKER_HOST` environment variable to set the 220 `-H` flag for the client. Use **one** of the following commands: 221 222 ```console 223 $ docker -H tcp://0.0.0.0:2375 ps 224 ``` 225 226 ```console 227 $ export DOCKER_HOST="tcp://0.0.0.0:2375" 228 229 $ docker ps 230 ``` 231 232 Setting the `DOCKER_TLS_VERIFY` environment variable to any value other than 233 the empty string is equivalent to setting the `--tlsverify` flag. The following 234 are equivalent: 235 236 ```console 237 $ docker --tlsverify ps 238 # or 239 $ export DOCKER_TLS_VERIFY=1 240 $ docker ps 241 ``` 242 243 The Docker client honors the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` 244 environment variables (or the lowercase versions thereof). `HTTPS_PROXY` takes 245 precedence over `HTTP_PROXY`. 246 247 The Docker client supports connecting to a remote daemon via SSH: 248 249 ```console 250 $ docker -H ssh://me@example.com:22/var/run/docker.sock ps 251 $ docker -H ssh://me@example.com:22 ps 252 $ docker -H ssh://me@example.com ps 253 $ docker -H ssh://example.com ps 254 ``` 255 256 To use SSH connection, you need to set up `ssh` so that it can reach the 257 remote host with public key authentication. Password authentication is not 258 supported. If your key is protected with passphrase, you need to set up 259 `ssh-agent`. 260 261 #### Bind Docker to another host/port or a Unix socket 262 263 > **Warning** 264 > 265 > Changing the default `docker` daemon binding to a TCP port or Unix `docker` 266 > user group introduces security risks, as it may allow non-root users to gain 267 > root access on the host. Make sure you control access to `docker`. If you are 268 > binding to a TCP port, anyone with access to that port has full Docker 269 > access; so it's not advisable on an open network. 270 { .warning } 271 272 With `-H` it's possible to make the Docker daemon to listen on a specific IP 273 and port. By default, it listens on `unix:///var/run/docker.sock` to allow 274 only local connections by the root user. You could set it to `0.0.0.0:2375` or 275 a specific host IP to give access to everybody, but that isn't recommended 276 because someone could gain root access to the host where the daemon is running. 277 278 Similarly, the Docker client can use `-H` to connect to a custom port. 279 The Docker client defaults to connecting to `unix:///var/run/docker.sock` 280 on Linux, and `tcp://127.0.0.1:2376` on Windows. 281 282 `-H` accepts host and port assignment in the following format: 283 284 ```text 285 tcp://[host]:[port][path] or unix://path 286 ``` 287 288 For example: 289 290 - `tcp://` -> TCP connection to `127.0.0.1` on either port `2376` when TLS encryption 291 is on, or port `2375` when communication is in plain text. 292 - `tcp://host:2375` -> TCP connection on 293 host:2375 294 - `tcp://host:2375/path` -> TCP connection on 295 host:2375 and prepend path to all requests 296 - `unix://path/to/socket` -> Unix socket located 297 at `path/to/socket` 298 299 `-H`, when empty, defaults to the same value as 300 when no `-H` was passed in. 301 302 `-H` also accepts short form for TCP bindings: `host:` or `host:port` or `:port` 303 304 Run Docker in daemon mode: 305 306 ```console 307 $ sudo <path to>/dockerd -H 0.0.0.0:5555 & 308 ``` 309 310 Download an `ubuntu` image: 311 312 ```console 313 $ docker -H :5555 pull ubuntu 314 ``` 315 316 You can use multiple `-H`, for example, if you want to listen on both 317 TCP and a Unix socket 318 319 ```console 320 $ sudo dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock & 321 # Download an ubuntu image, use default Unix socket 322 $ docker pull ubuntu 323 # OR use the TCP port 324 $ docker -H tcp://127.0.0.1:2375 pull ubuntu 325 ``` 326 327 ### Daemon storage-driver 328 329 On Linux, the Docker daemon has support for several different image layer storage 330 drivers: `overlay2`, `fuse-overlayfs`, `btrfs`, and `zfs`. 331 332 `overlay2` is the preferred storage driver for all currently supported Linux distributions, 333 and is selected by default. Unless users have a strong reason to prefer another storage driver, 334 `overlay2` should be used. 335 336 You can find out more about storage drivers and how to select one in [Select a storage driver](https://docs.docker.com/storage/storagedriver/select-storage-driver/). 337 338 On Windows, the Docker daemon only supports the `windowsfilter` storage driver. 339 340 ### Options per storage driver 341 342 Particular storage-driver can be configured with options specified with 343 `--storage-opt` flags. Options for `zfs` start with `zfs`, and options for 344 `btrfs` start with `btrfs`. 345 346 #### ZFS options 347 348 ##### `zfs.fsname` 349 350 Specifies the ZFS filesystem that the daemon should use to create its datasets. 351 By default, the ZFS filesystem in `/var/lib/docker` is used. 352 353 ###### Example 354 355 ```console 356 $ sudo dockerd -s zfs --storage-opt zfs.fsname=zroot/docker 357 ``` 358 359 #### Btrfs options 360 361 ##### `btrfs.min_space` 362 363 Specifies the minimum size to use when creating the subvolume which is used 364 for containers. If user uses disk quota for btrfs when creating or running 365 a container with **--storage-opt size** option, Docker should ensure the 366 **size** can't be smaller than **btrfs.min_space**. 367 368 ###### Example 369 370 ```console 371 $ sudo dockerd -s btrfs --storage-opt btrfs.min_space=10G 372 ``` 373 374 #### Overlay2 options 375 376 ##### `overlay2.size` 377 378 Sets the default max size of the container. It is supported only when the 379 backing filesystem is `xfs` and mounted with `pquota` mount option. Under these 380 conditions the user can pass any size less than the backing filesystem size. 381 382 ###### Example 383 384 ```console 385 $ sudo dockerd -s overlay2 --storage-opt overlay2.size=1G 386 ``` 387 388 389 #### Windowsfilter options 390 391 ##### `size` 392 393 Specifies the size to use when creating the sandbox which is used for containers. 394 Defaults to 20G. 395 396 ###### Example 397 398 ```powershell 399 C:\> dockerd --storage-opt size=40G 400 ``` 401 402 ### Runtime options 403 404 The Docker daemon relies on a 405 [OCI](https://github.com/opencontainers/runtime-spec) compliant runtime 406 (invoked via the `containerd` daemon) as its interface to the Linux 407 kernel `namespaces`, `cgroups`, and `SELinux`. 408 409 #### Configure container runtimes 410 411 By default, the Docker daemon uses runc as a container runtime. 412 You can configure the daemon to add additional runtimes. 413 414 containerd shims installed on `PATH` can be used directly, without the need 415 to edit the daemon's configuration. For example, if you install the Kata 416 Containers shim (`containerd-shim-kata-v2`) on `PATH`, then you can select that 417 runtime with `docker run` without having to edit the daemon's configuration: 418 419 ```console 420 $ docker run --runtime io.containerd.kata.v2 421 ``` 422 423 Container runtimes that don't implement containerd shims, or containerd shims 424 installed outside of `PATH`, must be registered with the daemon, either via the 425 configuration file or using the `--add-runtime` command line flag. 426 427 For examples on how to use other container runtimes, see 428 [Alternative container runtimes](https://docs.docker.com/engine/alternative-runtimes/) 429 430 ##### Configure runtimes using `daemon.json` 431 432 To register and configure container runtimes using the daemon's configuration 433 file, add the runtimes as entries under `runtimes`: 434 435 ```json 436 { 437 "runtimes": { 438 "<runtime>": {} 439 } 440 } 441 ``` 442 443 The key of the entry (`<runtime>` in the previous example) represents the name 444 of the runtime. This is the name that you reference when you run a container, 445 using `docker run --runtime <runtime>`. 446 447 The runtime entry contains an object specifying the configuration for your 448 runtime. The properties of the object depends on what kind of runtime you're 449 looking to register: 450 451 - If the runtime implements its own containerd shim, the object shall contain 452 a `runtimeType` field and an optional `options` field. 453 454 ```json 455 { 456 "runtimes": { 457 "<runtime>": { 458 "runtimeType": "<name-or-path>", 459 "options": {} 460 } 461 } 462 } 463 ``` 464 465 See [Configure shims](#configure-containerd-shims). 466 467 - If the runtime is designed to be a drop-in replacement for runc, 468 the object contains a `path` field, and an optional `runtimeArgs` field. 469 470 ```json 471 { 472 "runtimes": { 473 "<runtime>": { 474 "path": "/path/to/bin", 475 "runtimeArgs": ["...args"] 476 } 477 } 478 } 479 ``` 480 481 See [Configure runc drop-in replacements](#configure-runc-drop-in-replacements). 482 483 After changing the runtimes configuration in the configuration file, 484 you must reload or restart the daemon for changes to take effect: 485 486 ```console 487 $ sudo systemctl reload dockerd 488 ``` 489 490 ##### Configure containerd shims 491 492 If the runtime that you want to register implements a containerd shim, 493 or if you want to register a runtime which uses the runc shim, 494 use the following format for the runtime entry: 495 496 ```json 497 { 498 "runtimes": { 499 "<runtime>": { 500 "runtimeType": "<name-or-path>", 501 "options": {} 502 } 503 } 504 } 505 ``` 506 507 `runtimeType` refers to either: 508 509 - A fully qualified name of a containerd shim. 510 511 The fully qualified name of a shim is the same as the `runtime_type` used to 512 register the runtime in containerd's CRI configuration. 513 For example, `io.containerd.runsc.v1`. 514 515 - The path of a containerd shim binary. 516 517 This option is useful if you installed the containerd shim binary outside of 518 `PATH`. 519 520 `options` is optional. It lets you specify the runtime configuration that you 521 want to use for the shim. The configuration parameters that you can specify in 522 `options` depends on the runtime you're registering. For most shims, 523 the supported configuration options are `TypeUrl` and `ConfigPath`. 524 For example: 525 526 ```json 527 { 528 "runtimes": { 529 "gvisor": { 530 "runtimeType": "io.containerd.runsc.v1", 531 "options": { 532 "TypeUrl": "io.containerd.runsc.v1.options", 533 "ConfigPath": "/etc/containerd/runsc.toml", 534 } 535 } 536 } 537 } 538 ``` 539 540 You can configure multiple runtimes using the same runtimeType. For example: 541 542 ```json 543 { 544 "runtimes": { 545 "gvisor-foo": { 546 "runtimeType": "io.containerd.runsc.v1", 547 "options": { 548 "TypeUrl": "io.containerd.runsc.v1.options", 549 "ConfigPath": "/etc/containerd/runsc-foo.toml" 550 } 551 }, 552 "gvisor-bar": { 553 "runtimeType": "io.containerd.runsc.v1", 554 "options": { 555 "TypeUrl": "io.containerd.runsc.v1.options", 556 "ConfigPath": "/etc/containerd/runsc-bar.toml" 557 } 558 } 559 } 560 } 561 ``` 562 563 The `options` field takes a special set of configuration parameters when used 564 with `"runtimeType": "io.containerd.runc.v2"`. For more information about runc 565 parameters, refer to the runc configuration section in 566 [CRI Plugin Config Guide](https://github.com/containerd/containerd/blob/v1.7.2/docs/cri/config.md#full-configuration). 567 568 ##### Configure runc drop-in replacements 569 570 If the runtime that you want to register can act as a drop-in replacement for 571 runc, you can register the runtime either using the daemon configuration file, 572 or using the `--add-runtime` flag for the `dockerd` cli. 573 574 When you use the configuration file, the entry uses the following format: 575 576 ```json 577 { 578 "runtimes": { 579 "<runtime>": { 580 "path": "/path/to/binary", 581 "runtimeArgs": ["...args"] 582 } 583 } 584 } 585 ``` 586 587 Where `path` is either the absolute path to the runtime executable, or the name 588 of an executable installed on `PATH`: 589 590 ```json 591 { 592 "runtimes": { 593 "runc": { 594 "path": "runc" 595 } 596 } 597 } 598 ``` 599 600 And `runtimeArgs` lets you optionally pass additional arguments to the runtime. 601 Entries with this format use the containerd runc shim to invoke a custom 602 runtime binary. 603 604 When you use the `--add-runtime` CLI flag, use the following format: 605 606 ```console 607 $ sudo dockerd --add-runtime <runtime>=<path> 608 ``` 609 610 Defining runtime arguments via the command line is not supported. 611 612 For an example configuration for a runc drop-in replacment, see 613 [Alternative container runtimes > youki](https://docs.docker.com/engine/alternative-runtimes/#youki) 614 615 ##### Configure the default container runtime 616 617 You can specify either the name of a fully qualified containerd runtime shim, 618 or the name of a registered runtime. You can specify the default runtime either 619 using the daemon configuration file, or using the `--default-runtime` flag for 620 the `dockerd` cli. 621 622 When you use the configuration file, the entry uses the following format: 623 624 ```json 625 { 626 "default-runtime": "io.containerd.runsc.v1" 627 } 628 ``` 629 630 When you use the `--default-runtime` CLI flag, use the following format: 631 632 ```console 633 $ dockerd --default-runtime io.containerd.runsc.v1 634 ``` 635 636 #### Run containerd standalone 637 638 By default, the Docker daemon automatically starts `containerd`. If you want to 639 control `containerd` startup, manually start `containerd` and pass the path to 640 the `containerd` socket using the `--containerd` flag. For example: 641 642 ```console 643 $ sudo dockerd --containerd /run/containerd/containerd.sock 644 ``` 645 646 #### Configure cgroup driver 647 648 You can configure how the runtime should manage container cgroups, using the 649 `--exec-opt native.cgroupdriver` CLI flag. 650 651 You can only specify `cgroupfs` or `systemd`. If you specify 652 `systemd` and it is not available, the system errors out. If you omit the 653 `native.cgroupdriver` option,` cgroupfs` is used on cgroup v1 hosts, `systemd` 654 is used on cgroup v2 hosts with systemd available. 655 656 This example sets the `cgroupdriver` to `systemd`: 657 658 ```console 659 $ sudo dockerd --exec-opt native.cgroupdriver=systemd 660 ``` 661 662 Setting this option applies to all containers the daemon launches. 663 664 #### Configure container isolation technology (Windows) 665 666 For Windows containers, you can specify the default container isolation 667 technology to use, using the `--exec-opt isolation` flag. 668 669 The following example makes `hyperv` the default isolation technology: 670 671 ```console 672 > dockerd --exec-opt isolation=hyperv 673 ``` 674 675 If no isolation value is specified on daemon start, on Windows client, 676 the default is `hyperv`, and on Windows server, the default is `process`. 677 678 ### Daemon DNS options 679 680 To set the DNS server for all Docker containers, use: 681 682 ```console 683 $ sudo dockerd --dns 8.8.8.8 684 ``` 685 686 To set the DNS search domain for all Docker containers, use: 687 688 ```console 689 $ sudo dockerd --dns-search example.com 690 ``` 691 692 ### Allow push of non-distributable artifacts 693 694 Some images (e.g., Windows base images) contain artifacts whose distribution is 695 restricted by license. When these images are pushed to a registry, restricted 696 artifacts are not included. 697 698 To override this behavior for specific registries, use the 699 `--allow-nondistributable-artifacts` option in one of the following forms: 700 701 * `--allow-nondistributable-artifacts myregistry:5000` tells the Docker daemon 702 to push non-distributable artifacts to myregistry:5000. 703 * `--allow-nondistributable-artifacts 10.1.0.0/16` tells the Docker daemon to 704 push non-distributable artifacts to all registries whose resolved IP address 705 is within the subnet described by the CIDR syntax. 706 707 This option can be used multiple times. 708 709 This option is useful when pushing images containing non-distributable artifacts 710 to a registry on an air-gapped network so hosts on that network can pull the 711 images without connecting to another server. 712 713 > **Warning** 714 > 715 > Non-distributable artifacts typically have restrictions on how 716 > and where they can be distributed and shared. Only use this feature to push 717 > artifacts to private registries and ensure that you are in compliance with 718 > any terms that cover redistributing non-distributable artifacts. 719 { .warning } 720 721 ### Insecure registries 722 723 In this section, "registry" refers to a private registry, and `myregistry:5000` 724 is a placeholder example of a private registry. 725 726 Docker considers a private registry either secure or insecure. 727 A secure registry uses TLS and a copy of its CA certificate is placed on the 728 Docker host at `/etc/docker/certs.d/myregistry:5000/ca.crt`. An insecure 729 registry is either not using TLS (i.e., listening on plain text HTTP), or is 730 using TLS with a CA certificate not known by the Docker daemon. The latter can 731 happen when the certificate wasn't found under 732 `/etc/docker/certs.d/myregistry:5000/`, or if the certificate verification 733 failed (i.e., wrong CA). 734 735 By default, Docker assumes all registries to be secure, except for local registries. 736 Communicating with an insecure registry isn't possible 737 if Docker assumes that registry is secure. In order to communicate with an 738 insecure registry, the Docker daemon requires `--insecure-registry` in one of 739 the following two forms: 740 741 * `--insecure-registry myregistry:5000` tells the Docker daemon that 742 myregistry:5000 should be considered insecure. 743 * `--insecure-registry 10.1.0.0/16` tells the Docker daemon that all registries 744 whose domain resolve to an IP address is part of the subnet described by the 745 CIDR syntax, should be considered insecure. 746 747 The flag can be used multiple times to allow multiple registries to be marked 748 as insecure. 749 750 If an insecure registry isn't marked as insecure, `docker pull`, 751 `docker push`, and `docker search` result in error messages, prompting 752 the user to either secure or pass the `--insecure-registry` flag to the Docker 753 daemon as described above. 754 755 Local registries, whose IP address falls in the 127.0.0.0/8 range, are 756 automatically marked as insecure as of Docker 1.3.2. It isn't recommended to 757 rely on this, as it may change in the future. 758 759 Enabling `--insecure-registry`, i.e., allowing un-encrypted and/or untrusted 760 communication, can be useful when running a local registry. However, 761 because its use creates security vulnerabilities it should only be enabled for 762 testing purposes. For increased security, users should add their CA to their 763 system's list of trusted CAs instead of enabling `--insecure-registry`. 764 765 #### Legacy Registries 766 767 Operations against registries supporting only the legacy v1 protocol are no longer 768 supported. Specifically, the daemon doesn't attempt to push, pull or sign in 769 to v1 registries. The exception to this is `search` which can still be performed 770 on v1 registries. 771 772 ### Running a Docker daemon behind an HTTPS_PROXY 773 774 When running inside a LAN that uses an `HTTPS` proxy, the proxy's certificates 775 replace Docker Hub's certificates. These certificates must be added to your 776 Docker host's configuration: 777 778 1. Install the `ca-certificates` package for your distribution 779 2. Ask your network admin for the proxy's CA certificate and append them to 780 `/etc/pki/tls/certs/ca-bundle.crt` 781 3. Then start your Docker daemon with `HTTPS_PROXY=http://username:password@proxy:port/ dockerd`. 782 The `username:` and `password@` are optional - and are only needed if your 783 proxy is set up to require authentication. 784 785 This only adds the proxy and authentication to the Docker daemon's requests. 786 To use the proxy when building images and running containers, see 787 [Configure Docker to use a proxy server](https://docs.docker.com/network/proxy/) 788 789 ### Default `ulimit` settings 790 791 The `--default-ulimit` flag lets you set the default `ulimit` options to use for 792 all containers. It takes the same options as `--ulimit` for `docker run`. If 793 these defaults aren't set, `ulimit` settings are inherited from the Docker daemon. 794 Any `--ulimit` options passed to `docker run` override the daemon defaults. 795 796 Be careful setting `nproc` with the `ulimit` flag, as `nproc` is designed by Linux to 797 set the maximum number of processes available to a user, not to a container. 798 For details, see [`docker run` reference](https://docs.docker.com/reference/cli/docker/container/run/#ulimit). 799 800 ### Access authorization 801 802 Docker's access authorization can be extended by authorization plugins that your 803 organization can purchase or build themselves. You can install one or more 804 authorization plugins when you start the Docker `daemon` using the 805 `--authorization-plugin=PLUGIN_ID` option. 806 807 ```console 808 $ sudo dockerd --authorization-plugin=plugin1 --authorization-plugin=plugin2,... 809 ``` 810 811 The `PLUGIN_ID` value is either the plugin's name or a path to its specification 812 file. The plugin's implementation determines whether you can specify a name or 813 path. Consult with your Docker administrator to get information about the 814 plugins available to you. 815 816 Once a plugin is installed, requests made to the `daemon` through the 817 command line or Docker's Engine API are allowed or denied by the plugin. 818 If you have multiple plugins installed, each plugin, in order, must 819 allow the request for it to complete. 820 821 For information about how to create an authorization plugin, refer to the 822 [authorization plugin](https://docs.docker.com/engine/extend/plugins_authorization/) section. 823 824 ### Daemon user namespace options 825 826 The Linux kernel 827 [user namespace support](https://man7.org/linux/man-pages/man7/user_namespaces.7.html) 828 provides additional security by enabling a process, and therefore a container, 829 to have a unique range of user and group IDs which are outside the traditional 830 user and group range utilized by the host system. One of the most important 831 security improvements is that, by default, container processes running as the 832 `root` user have expected administrative privileges it expects (with some restrictions) 833 inside the container, but are effectively mapped to an unprivileged `uid` on 834 the host. 835 836 For details about how to use this feature, as well as limitations, see 837 [Isolate containers with a user namespace](https://docs.docker.com/engine/security/userns-remap/). 838 839 ### Configure host gateway IP 840 841 The Docker daemon supports a special `host-gateway` value for the `--add-host` 842 flag for the `docker run` and `docker build` commands. This value resolves to 843 the host's gateway IP and lets containers connect to services running on the 844 host. 845 846 By default, `host-gateway` resolves to the IP address of the default bridge. 847 You can configure this to resolve to a different IP using the `--host-gateway-ip` 848 flag for the dockerd command line interface, or the `host-gateway-ip` key in 849 the daemon configuration file. 850 851 ```console 852 $ cat > /etc/docker/daemon.json 853 { "host-gateway-ip": "192.0.2.0" } 854 $ sudo systemctl restart docker 855 $ docker run -it --add-host host.docker.internal:host-gateway \ 856 busybox ping host.docker.internal 857 PING host.docker.internal (192.0.2.0): 56 data bytes 858 ``` 859 860 ### Enable CDI devices 861 862 > **Note** 863 > 864 > This is experimental feature and as such doesn't represent a stable API. 865 > 866 > This feature isn't enabled by default. To this feature, set `features.cdi` to 867 > `true` in the `daemon.json` configuration file. 868 869 Container Device Interface (CDI) is a 870 [standardized](https://github.com/cncf-tags/container-device-interface/blob/main/SPEC.md) 871 mechanism for container runtimes to create containers which are able to 872 interact with third party devices. 873 874 The Docker daemon supports running containers with CDI devices if the requested 875 device specifications are available on the filesystem of the daemon. 876 877 The default specification directors are: 878 879 - `/etc/cdi/` for static CDI Specs 880 - `/var/run/cdi` for generated CDI Specs 881 882 Alternatively, you can set custom locations for CDI specifications using the 883 `cdi-spec-dirs` option in the `daemon.json` configuration file, or the 884 `--cdi-spec-dir` flag for the `dockerd` CLI. 885 886 ```json 887 { 888 "features": { 889 "cdi": true 890 }, 891 "cdi-spec-dirs": ["/etc/cdi/", "/var/run/cdi"] 892 } 893 ``` 894 895 When CDI is enabled for a daemon, you can view the configured CDI specification 896 directories using the `docker info` command. 897 898 ### Miscellaneous options 899 900 IP masquerading uses address translation to allow containers without a public 901 IP to talk to other machines on the internet. This may interfere with some 902 network topologies, and can be disabled with `--ip-masq=false`. 903 904 Docker supports soft links for the Docker data directory (`/var/lib/docker`) and 905 for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be 906 set like this: 907 908 ```console 909 $ export DOCKER_TMPDIR=/mnt/disk2/tmp 910 $ sudo -E dockerd --data-root /var/lib/docker -H unix:// 911 ```` 912 913 #### Default cgroup parent 914 915 The `--cgroup-parent` option lets you set the default cgroup parent 916 for containers. If this option isn't set, it defaults to `/docker` for 917 the cgroupfs driver, and `system.slice` for the systemd cgroup driver. 918 919 If the cgroup has a leading forward slash (`/`), the cgroup is created 920 under the root cgroup, otherwise the cgroup is created under the daemon 921 cgroup. 922 923 Assuming the daemon is running in cgroup `daemoncgroup`, 924 `--cgroup-parent=/foobar` creates a cgroup in 925 `/sys/fs/cgroup/memory/foobar`, whereas using `--cgroup-parent=foobar` 926 creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar` 927 928 The systemd cgroup driver has different rules for `--cgroup-parent`. systemd 929 represents hierarchy by slice and the name of the slice encodes the location in 930 the tree. So `--cgroup-parent` for systemd cgroups should be a slice name. A 931 name can consist of a dash-separated series of names, which describes the path 932 to the slice from the root slice. For example, `--cgroup-parent=user-a-b.slice` 933 means the memory cgroup for the container is created in 934 `/sys/fs/cgroup/memory/user.slice/user-a.slice/user-a-b.slice/docker-<id>.scope`. 935 936 This setting can also be set per container, using the `--cgroup-parent` 937 option on `docker create` and `docker run`, and takes precedence over 938 the `--cgroup-parent` option on the daemon. 939 940 #### Daemon metrics 941 942 The `--metrics-addr` option takes a TCP address to serve the metrics API. 943 This feature is still experimental, therefore, the daemon must be running in experimental 944 mode for this feature to work. 945 946 To serve the metrics API on `localhost:9323` you would specify `--metrics-addr 127.0.0.1:9323`, 947 allowing you to make requests on the API at `127.0.0.1:9323/metrics` to receive metrics in the 948 [prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) format. 949 950 Port `9323` is the [default port associated with Docker 951 metrics](https://github.com/prometheus/prometheus/wiki/Default-port-allocations) 952 to avoid collisions with other Prometheus exporters and services. 953 954 If you are running a Prometheus server you can add this address to your scrape configs 955 to have Prometheus collect metrics on Docker. For more information, see 956 [Collect Docker metrics with Prometheus](https://docs.docker.com/config/daemon/prometheus/). 957 958 #### Node generic resources 959 960 The `--node-generic-resources` option takes a list of key-value 961 pair (`key=value`) that allows you to advertise user defined resources 962 in a Swarm cluster. 963 964 The current expected use case is to advertise NVIDIA GPUs so that services 965 requesting `NVIDIA-GPU=[0-16]` can land on a node that has enough GPUs for 966 the task to run. 967 968 Example of usage: 969 970 ```json 971 { 972 "node-generic-resources": [ 973 "NVIDIA-GPU=UUID1", 974 "NVIDIA-GPU=UUID2" 975 ] 976 } 977 ``` 978 979 ### Daemon configuration file 980 981 The `--config-file` option allows you to set any configuration option 982 for the daemon in a JSON format. This file uses the same flag names as keys, 983 except for flags that allow several entries, where it uses the plural 984 of the flag name, e.g., `labels` for the `label` flag. 985 986 The options set in the configuration file must not conflict with options set 987 using flags. The Docker daemon fails to start if an option is duplicated between 988 the file and the flags, regardless of their value. This is intentional, and avoids 989 silently ignore changes introduced in configuration reloads. 990 For example, the daemon fails to start if you set daemon labels 991 in the configuration file and also set daemon labels via the `--label` flag. 992 Options that are not present in the file are ignored when the daemon starts. 993 994 The `--validate` option allows to validate a configuration file without 995 starting the Docker daemon. A non-zero exit code is returned for invalid 996 configuration files. 997 998 ```console 999 $ dockerd --validate --config-file=/tmp/valid-config.json 1000 configuration OK 1001 1002 $ echo $? 1003 0 1004 1005 $ dockerd --validate --config-file /tmp/invalid-config.json 1006 unable to configure the Docker daemon with file /tmp/invalid-config.json: the following directives don't match any configuration option: unknown-option 1007 1008 $ echo $? 1009 1 1010 ``` 1011 1012 ##### On Linux 1013 1014 The default location of the configuration file on Linux is 1015 `/etc/docker/daemon.json`. Use the `--config-file` flag to specify a 1016 non-default location. 1017 1018 The following is a full example of the allowed configuration options on Linux: 1019 1020 ```json 1021 { 1022 "allow-nondistributable-artifacts": [], 1023 "api-cors-header": "", 1024 "authorization-plugins": [], 1025 "bip": "", 1026 "bridge": "", 1027 "builder": { 1028 "gc": { 1029 "enabled": true, 1030 "defaultKeepStorage": "10GB", 1031 "policy": [ 1032 { "keepStorage": "10GB", "filter": ["unused-for=2200h"] }, 1033 { "keepStorage": "50GB", "filter": ["unused-for=3300h"] }, 1034 { "keepStorage": "100GB", "all": true } 1035 ] 1036 } 1037 }, 1038 "cgroup-parent": "", 1039 "containerd": "/run/containerd/containerd.sock", 1040 "containerd-namespace": "docker", 1041 "containerd-plugins-namespace": "docker-plugins", 1042 "data-root": "", 1043 "debug": true, 1044 "default-address-pools": [ 1045 { 1046 "base": "172.30.0.0/16", 1047 "size": 24 1048 }, 1049 { 1050 "base": "172.31.0.0/16", 1051 "size": 24 1052 } 1053 ], 1054 "default-cgroupns-mode": "private", 1055 "default-gateway": "", 1056 "default-gateway-v6": "", 1057 "default-network-opts": {}, 1058 "default-runtime": "runc", 1059 "default-shm-size": "64M", 1060 "default-ulimits": { 1061 "nofile": { 1062 "Hard": 64000, 1063 "Name": "nofile", 1064 "Soft": 64000 1065 } 1066 }, 1067 "dns": [], 1068 "dns-opts": [], 1069 "dns-search": [], 1070 "exec-opts": [], 1071 "exec-root": "", 1072 "experimental": false, 1073 "features": {}, 1074 "fixed-cidr": "", 1075 "fixed-cidr-v6": "", 1076 "group": "", 1077 "host-gateway-ip": "", 1078 "hosts": [], 1079 "proxies": { 1080 "http-proxy": "http://proxy.example.com:80", 1081 "https-proxy": "https://proxy.example.com:443", 1082 "no-proxy": "*.test.example.com,.example.org" 1083 }, 1084 "icc": false, 1085 "init": false, 1086 "init-path": "/usr/libexec/docker-init", 1087 "insecure-registries": [], 1088 "ip": "0.0.0.0", 1089 "ip-forward": false, 1090 "ip-masq": false, 1091 "iptables": false, 1092 "ip6tables": false, 1093 "ipv6": false, 1094 "labels": [], 1095 "live-restore": true, 1096 "log-driver": "json-file", 1097 "log-level": "", 1098 "log-opts": { 1099 "cache-disabled": "false", 1100 "cache-max-file": "5", 1101 "cache-max-size": "20m", 1102 "cache-compress": "true", 1103 "env": "os,customer", 1104 "labels": "somelabel", 1105 "max-file": "5", 1106 "max-size": "10m" 1107 }, 1108 "max-concurrent-downloads": 3, 1109 "max-concurrent-uploads": 5, 1110 "max-download-attempts": 5, 1111 "mtu": 0, 1112 "no-new-privileges": false, 1113 "node-generic-resources": [ 1114 "NVIDIA-GPU=UUID1", 1115 "NVIDIA-GPU=UUID2" 1116 ], 1117 "oom-score-adjust": 0, 1118 "pidfile": "", 1119 "raw-logs": false, 1120 "registry-mirrors": [], 1121 "runtimes": { 1122 "cc-runtime": { 1123 "path": "/usr/bin/cc-runtime" 1124 }, 1125 "custom": { 1126 "path": "/usr/local/bin/my-runc-replacement", 1127 "runtimeArgs": [ 1128 "--debug" 1129 ] 1130 } 1131 }, 1132 "seccomp-profile": "", 1133 "selinux-enabled": false, 1134 "shutdown-timeout": 15, 1135 "storage-driver": "", 1136 "storage-opts": [], 1137 "swarm-default-advertise-addr": "", 1138 "tls": true, 1139 "tlscacert": "", 1140 "tlscert": "", 1141 "tlskey": "", 1142 "tlsverify": true, 1143 "userland-proxy": false, 1144 "userland-proxy-path": "/usr/libexec/docker-proxy", 1145 "userns-remap": "" 1146 } 1147 ``` 1148 1149 > **Note** 1150 > 1151 > You can't set options in `daemon.json` that have already been set on 1152 > daemon startup as a flag. 1153 > On systems that use systemd to start the Docker daemon, `-H` is already set, so 1154 > you can't use the `hosts` key in `daemon.json` to add listening addresses. 1155 > See [custom Docker daemon options](https://docs.docker.com/config/daemon/systemd/#custom-docker-daemon-options) 1156 > for an example on how to configure the daemon using systemd drop-in files. 1157 1158 ##### On Windows 1159 1160 The default location of the configuration file on Windows is 1161 `%programdata%\docker\config\daemon.json`. Use the `--config-file` flag 1162 to specify a non-default location. 1163 1164 The following is a full example of the allowed configuration options on Windows: 1165 1166 ```json 1167 { 1168 "allow-nondistributable-artifacts": [], 1169 "authorization-plugins": [], 1170 "bridge": "", 1171 "containerd": "\\\\.\\pipe\\containerd-containerd", 1172 "containerd-namespace": "docker", 1173 "containerd-plugins-namespace": "docker-plugins", 1174 "data-root": "", 1175 "debug": true, 1176 "default-network-opts": {}, 1177 "default-runtime": "", 1178 "default-ulimits": {}, 1179 "dns": [], 1180 "dns-opts": [], 1181 "dns-search": [], 1182 "exec-opts": [], 1183 "experimental": false, 1184 "features": {}, 1185 "fixed-cidr": "", 1186 "group": "", 1187 "host-gateway-ip": "", 1188 "hosts": [], 1189 "insecure-registries": [], 1190 "labels": [], 1191 "log-driver": "", 1192 "log-level": "", 1193 "max-concurrent-downloads": 3, 1194 "max-concurrent-uploads": 5, 1195 "max-download-attempts": 5, 1196 "mtu": 0, 1197 "pidfile": "", 1198 "raw-logs": false, 1199 "registry-mirrors": [], 1200 "shutdown-timeout": 15, 1201 "storage-driver": "", 1202 "storage-opts": [], 1203 "swarm-default-advertise-addr": "", 1204 "tlscacert": "", 1205 "tlscert": "", 1206 "tlskey": "", 1207 "tlsverify": true 1208 } 1209 ``` 1210 1211 The `default-runtime` option is by default unset, in which case dockerd automatically detects the runtime. 1212 This detection is based on if the `containerd` flag is set. 1213 1214 Accepted values: 1215 1216 - `com.docker.hcsshim.v1` - This is the built-in runtime that Docker has used since Windows supported was first added and uses the v1 HCS API's in Windows. 1217 - `io.containerd.runhcs.v1` - This is uses the containerd `runhcs` shim to run the container and uses the v2 HCS API's in Windows. 1218 1219 #### Feature options 1220 1221 The optional field `features` in `daemon.json` lets you enable or disable specific 1222 daemon features. 1223 1224 ```json 1225 { 1226 "features": { 1227 "some-feature": true, 1228 "some-disabled-feature-enabled-by-default": false 1229 } 1230 } 1231 ``` 1232 1233 The list of feature options include: 1234 1235 - `containerd-snapshotter`: when set to `true`, the daemon uses containerd 1236 snapshotters instead of the classic storage drivers for storing image and 1237 container data. For more information, see 1238 [containerd storage](https://docs.docker.com/storage/containerd/). 1239 1240 #### Configuration reload behavior 1241 1242 Some options can be reconfigured when the daemon is running without requiring 1243 to restart the process. The daemon uses the `SIGHUP` signal in Linux to reload, 1244 and a global event in Windows with the key `Global\docker-daemon-config-$PID`. 1245 You can modify the options in the configuration file, but the daemon still 1246 checks for conflicting settings with the specified CLI flags. The daemon fails 1247 to reconfigure itself if there are conflicts, but it won't stop execution. 1248 1249 The list of currently supported options that can be reconfigured is this: 1250 1251 | Option | Description | 1252 | ---------------------------------- | ----------------------------------------------------------------------------------------------------------- | 1253 | `debug` | Toggles debug mode of the daemon. | 1254 | `labels` | Replaces the daemon labels with a new set of labels. | 1255 | `live-restore` | Toggles [live restore](https://docs.docker.com/config/containers/live-restore/). | 1256 | `max-concurrent-downloads` | Configures the max concurrent downloads for each pull. | 1257 | `max-concurrent-uploads` | Configures the max concurrent uploads for each push. | 1258 | `max-download-attempts` | Configures the max download attempts for each pull. | 1259 | `default-runtime` | Configures the runtime to be used if not is specified at container creation. | 1260 | `runtimes` | Configures the list of available OCI runtimes that can be used to run containers. | 1261 | `authorization-plugin` | Specifies the authorization plugins to use. | 1262 | `allow-nondistributable-artifacts` | Specifies a list of registries to which the daemon will push non-distributable artifacts. | 1263 | `insecure-registries` | Specifies a list of registries that the daemon should consider insecure. | 1264 | `registry-mirrors` | Specifies a list of registry mirrors. | 1265 | `shutdown-timeout` | Configures the daemon's existing configuration timeout with a new timeout for shutting down all containers. | 1266 | `features` | Enables or disables specific features. | 1267 1268 ### Run multiple daemons 1269 1270 > **Note** 1271 > 1272 > Running multiple daemons on a single host is considered experimental. 1273 > You may encounter unsolved problems, and things may not work as expected in some cases. 1274 1275 This section describes how to run multiple Docker daemons on a single host. To 1276 run multiple daemons, you must configure each daemon so that it doesn't 1277 conflict with other daemons on the same host. You can set these options either 1278 by providing them as flags, or by using a [daemon configuration file](#daemon-configuration-file). 1279 1280 The following daemon options must be configured for each daemon: 1281 1282 ```text 1283 -b, --bridge= Attach containers to a network bridge 1284 --exec-root=/var/run/docker Root of the Docker execdriver 1285 --data-root=/var/lib/docker Root of persisted Docker data 1286 -p, --pidfile=/var/run/docker.pid Path to use for daemon PID file 1287 -H, --host=[] Daemon socket(s) to connect to 1288 --iptables=true Enable addition of iptables rules 1289 --config-file=/etc/docker/daemon.json Daemon configuration file 1290 --tlscacert="~/.docker/ca.pem" Trust certs signed only by this CA 1291 --tlscert="~/.docker/cert.pem" Path to TLS certificate file 1292 --tlskey="~/.docker/key.pem" Path to TLS key file 1293 ``` 1294 1295 When your daemons use different values for these flags, you can run them on the same host without any problems. 1296 It is important that you understand the meaning of these options and to use them correctly. 1297 1298 - The `-b, --bridge=` flag is set to `docker0` as default bridge network. 1299 It is created automatically when you install Docker. 1300 If you aren't using the default, you must create and configure the bridge manually, or set it to 'none': `--bridge=none` 1301 - `--exec-root` is the path where the container state is stored. 1302 The default value is `/var/run/docker`. 1303 Specify the path for your running daemon here. 1304 - `--data-root` is the path where persisted data such as images, volumes, and 1305 cluster state are stored. The default value is `/var/lib/docker`. To avoid any 1306 conflict with other daemons, set this parameter separately for each daemon. 1307 - `-p, --pidfile=/var/run/docker.pid` is the path where the process ID of the daemon is stored. 1308 Specify the path for your PID file here. 1309 - `--host=[]` specifies where the Docker daemon listens for client connections. 1310 If unspecified, it defaults to `/var/run/docker.sock`. 1311 - `--iptables=false` prevents the Docker daemon from adding iptables rules. If 1312 multiple daemons manage iptables rules, they may overwrite rules set by another 1313 daemon. Be aware that disabling this option requires you to manually add 1314 iptables rules to expose container ports. If you prevent Docker from adding 1315 iptables rules, Docker also doesn't add IP masquerading rules, even if you set 1316 `--ip-masq` to `true`. Without IP masquerading rules, Docker containers can't 1317 connect to external hosts or the internet when using network other than default bridge. 1318 - `--config-file=/etc/docker/daemon.json` is the path where configuration file is stored. 1319 You can use it instead of daemon flags. Specify the path for each daemon. 1320 - `--tls*` Docker daemon supports `--tlsverify` mode that enforces encrypted and authenticated remote connections. 1321 The `--tls*` options enable use of specific certificates for individual daemons. 1322 1323 Example script for a separate “bootstrap” instance of the Docker daemon without network: 1324 1325 ```console 1326 $ sudo dockerd \ 1327 -H unix:///var/run/docker-bootstrap.sock \ 1328 -p /var/run/docker-bootstrap.pid \ 1329 --iptables=false \ 1330 --ip-masq=false \ 1331 --bridge=none \ 1332 --data-root=/var/lib/docker-bootstrap \ 1333 --exec-root=/var/run/docker-bootstrap 1334 ``` 1335 1336 ### Default network options 1337 1338 The `default-network-opts` key in the `daemon.json` configuration file, and the 1339 equivalent `--default-network-opt` CLI flag, let you specify default values for 1340 driver network driver options for new networks. 1341 1342 The following example shows how to configure options for the `bridge` driver 1343 using the `daemon.json` file. 1344 1345 ```json 1346 { 1347 "default-network-opts": { 1348 "bridge": { 1349 "com.docker.network.bridge.host_binding_ipv4": "127.0.0.1", 1350 "com.docker.network.driver.mtu": "1234" 1351 } 1352 } 1353 } 1354 ``` 1355 1356 This example uses the `bridge` network driver. Refer to the 1357 [bridge network driver page](https://docs.docker.com/network/drivers/bridge/#options) 1358 for an overview of available driver options. 1359 1360 After changing the configuration and restarting the daemon, new networks that 1361 you create use these option configurations as defaults. 1362 1363 ```console 1364 $ docker network create mynet 1365 $ docker network inspect mynet --format "{{json .Options}}" 1366 {"com.docker.network.bridge.host_binding_ipv4":"127.0.0.1","com.docker.network.driver.mtu":"1234"} 1367 ``` 1368 1369 Note that changing this daemon configuration doesn't affect pre-existing 1370 networks. 1371 1372 Using the `--default-network-opt` CLI flag is useful for testing and debugging 1373 purposes, but you should prefer using the `daemon.json` file for persistent 1374 daemon configuration. The CLI flag expects a value with the following format: 1375 `driver=opt=value`, for example: 1376 1377 ```console 1378 $ sudo dockerd \ 1379 --default-network-opt bridge=com.docker.network.bridge.host_binding_ipv4=127.0.0.1 \ 1380 --default-network-opt bridge=com.docker.network.driver.mtu=1234 1381 ```