github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/docs/reference/commandline/dockerd.md (about) 1 --- 2 title: "dockerd" 3 description: "The daemon command description and usage" 4 keywords: "container, daemon, runtime" 5 redirect_from: 6 - /engine/reference/commandline/daemon/ 7 --- 8 9 <!-- This file is maintained within the docker/cli GitHub 10 repository at https://github.com/docker/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 COMMAND 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 --cgroup-parent string Set parent cgroup for all containers 33 --config-file string Daemon configuration file (default "/etc/docker/daemon.json") 34 --containerd string containerd grpc address 35 --containerd-namespace string Containerd namespace to use (default "moby") 36 --containerd-plugins-namespace string Containerd namespace to use for plugins (default "plugins.moby") 37 --cpu-rt-period int Limit the CPU real-time period in microseconds for the 38 parent cgroup for all containers 39 --cpu-rt-runtime int Limit the CPU real-time runtime in microseconds for the 40 parent cgroup for all containers 41 --cri-containerd start containerd with cri 42 --data-root string Root directory of persistent Docker state (default "/var/lib/docker") 43 -D, --debug Enable debug mode 44 --default-address-pool pool-options Default address pools for node specific local networks 45 --default-cgroupns-mode string Default mode for containers cgroup namespace ("host" | "private") (default "host") 46 --default-gateway ip Container default gateway IPv4 address 47 --default-gateway-v6 ip Container default gateway IPv6 address 48 --default-ipc-mode string Default mode for containers ipc ("shareable" | "private") (default "private") 49 --default-runtime string Default OCI runtime for containers (default "runc") 50 --default-shm-size bytes Default shm size for containers (default 64MiB) 51 --default-ulimit ulimit Default ulimits for containers (default []) 52 --dns list DNS server to use 53 --dns-opt list DNS options to use 54 --dns-search list DNS search domains to use 55 --exec-opt list Runtime execution options 56 --exec-root string Root directory for execution state files (default "/var/run/docker") 57 --experimental Enable experimental features 58 --fixed-cidr string IPv4 subnet for fixed IPs 59 --fixed-cidr-v6 string IPv6 subnet for fixed IPs 60 -G, --group string Group for the unix socket (default "docker") 61 --help Print usage 62 -H, --host list Daemon socket(s) to connect to 63 --host-gateway-ip ip IP address that the special 'host-gateway' string in --add-host resolves to. 64 Defaults to the IP address of the default bridge 65 --icc Enable inter-container communication (default true) 66 --init Run an init in the container to forward signals and reap processes 67 --init-path string Path to the docker-init binary 68 --insecure-registry list Enable insecure registry communication 69 --ip ip Default IP when binding container ports (default 0.0.0.0) 70 --ip-forward Enable net.ipv4.ip_forward (default true) 71 --ip-masq Enable IP masquerading (default true) 72 --iptables Enable addition of iptables rules (default true) 73 --ip6tables Enable addition of ip6tables rules (default false) 74 --ipv6 Enable IPv6 networking 75 --label list Set key=value labels to the daemon 76 --live-restore Enable live restore of docker when containers are still running 77 --log-driver string Default driver for container logs (default "json-file") 78 -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info") 79 --log-opt map Default log driver options for containers (default map[]) 80 --max-concurrent-downloads int Set the max concurrent downloads (default 3) 81 --max-concurrent-uploads int Set the max concurrent uploads (default 5) 82 --max-download-attempts int Set the max download attempts for each pull (default 5) 83 --metrics-addr string Set default address and port to serve the metrics api on 84 --mtu int Set the containers network MTU 85 --network-control-plane-mtu int Network Control plane MTU (default 1500) 86 --no-new-privileges Set no-new-privileges by default for new containers 87 --node-generic-resource list Advertise user-defined resource 88 --oom-score-adjust int Set the oom_score_adj for the daemon (default -500) 89 -p, --pidfile string Path to use for daemon PID file (default "/var/run/docker.pid") 90 --raw-logs Full timestamps without ANSI coloring 91 --registry-mirror list Preferred registry mirror 92 --rootless Enable rootless mode; typically used with RootlessKit 93 --seccomp-profile string Path to seccomp profile 94 --selinux-enabled Enable selinux support 95 --shutdown-timeout int Set the default shutdown timeout (default 15) 96 -s, --storage-driver string Storage driver to use 97 --storage-opt list Storage driver options 98 --swarm-default-advertise-addr string Set default address or interface for swarm advertised address 99 --tls Use TLS; implied by --tlsverify 100 --tlscacert string Trust certs signed only by this CA (default "~/.docker/ca.pem") 101 --tlscert string Path to TLS certificate file (default "~/.docker/cert.pem") 102 --tlskey string Path to TLS key file (default "~/.docker/key.pem") 103 --tlsverify Use TLS and verify the remote 104 --userland-proxy Use userland proxy for loopback traffic (default true) 105 --userland-proxy-path string Path to the userland proxy binary 106 --userns-remap string User/Group setting for user namespaces 107 --validate Validate daemon configuration and exit 108 -v, --version Print version information and quit 109 ``` 110 111 Options with [] may be specified multiple times. 112 113 ## Description 114 115 `dockerd` is the persistent process that manages containers. Docker 116 uses different binaries for the daemon and client. To run the daemon you 117 type `dockerd`. 118 119 To run the daemon with debug output, use `dockerd --debug` or add `"debug": true` 120 to [the `daemon.json` file](#daemon-configuration-file). 121 122 > **Enabling experimental features** 123 > 124 > Enable experimental features by starting `dockerd` with the `--experimental` 125 > flag or adding `"experimental": true` to the `daemon.json` file. 126 127 ### Environment variables 128 129 For easy reference, the following list of environment variables are supported 130 by the `dockerd` command line: 131 132 * `DOCKER_DRIVER` The graph driver to use. 133 * `DOCKER_NOWARN_KERNEL_VERSION` Prevent warnings that your Linux kernel is 134 unsuitable for Docker. 135 * `DOCKER_RAMDISK` If set this will disable 'pivot_root'. 136 * `DOCKER_TMPDIR` Location for temporary Docker files. 137 * `MOBY_DISABLE_PIGZ` Do not use [`unpigz`](https://linux.die.net/man/1/pigz) to 138 decompress layers in parallel when pulling images, even if it is installed. 139 140 ## Examples 141 142 ### Daemon socket option 143 144 The Docker daemon can listen for [Docker Engine API](https://docs.docker.com/engine/api/) 145 requests via three different types of Socket: `unix`, `tcp`, and `fd`. 146 147 By default, a `unix` domain socket (or IPC socket) is created at 148 `/var/run/docker.sock`, requiring either `root` permission, or `docker` group 149 membership. 150 151 If you need to access the Docker daemon remotely, you need to enable the `tcp` 152 Socket. Beware that the default setup provides un-encrypted and 153 un-authenticated direct access to the Docker daemon - and should be secured 154 either using the [built in HTTPS encrypted socket](https://docs.docker.com/engine/security/https/), or by 155 putting a secure web proxy in front of it. You can listen on port `2375` on all 156 network interfaces with `-H tcp://0.0.0.0:2375`, or on a particular network 157 interface using its IP address: `-H tcp://192.168.59.103:2375`. It is 158 conventional to use port `2375` for un-encrypted, and port `2376` for encrypted 159 communication with the daemon. 160 161 > **Note** 162 > 163 > If you're using an HTTPS encrypted socket, keep in mind that only 164 > TLS1.0 and greater are supported. Protocols SSLv3 and under are not 165 > supported anymore for security reasons. 166 167 On Systemd based systems, you can communicate with the daemon via 168 [Systemd socket activation](https://0pointer.de/blog/projects/socket-activation.html), 169 use `dockerd -H fd://`. Using `fd://` will work perfectly for most setups but 170 you can also specify individual sockets: `dockerd -H fd://3`. If the 171 specified socket activated files aren't found, then Docker will exit. You can 172 find examples of using Systemd socket activation with Docker and Systemd in the 173 [Docker source tree](https://github.com/docker/docker/tree/master/contrib/init/systemd/). 174 175 You can configure the Docker daemon to listen to multiple sockets at the same 176 time using multiple `-H` options: 177 178 The example below runs the daemon listenin on the default unix socket, and 179 on 2 specific IP addresses on this host: 180 181 ```console 182 $ sudo dockerd -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2 183 ``` 184 185 The Docker client will honor the `DOCKER_HOST` environment variable to set the 186 `-H` flag for the client. Use **one** of the following commands: 187 188 ```console 189 $ docker -H tcp://0.0.0.0:2375 ps 190 ``` 191 192 ```console 193 $ export DOCKER_HOST="tcp://0.0.0.0:2375" 194 195 $ docker ps 196 ``` 197 198 Setting the `DOCKER_TLS_VERIFY` environment variable to any value other than 199 the empty string is equivalent to setting the `--tlsverify` flag. The following 200 are equivalent: 201 202 ```console 203 $ docker --tlsverify ps 204 # or 205 $ export DOCKER_TLS_VERIFY=1 206 $ docker ps 207 ``` 208 209 The Docker client will honor the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` 210 environment variables (or the lowercase versions thereof). `HTTPS_PROXY` takes 211 precedence over `HTTP_PROXY`. 212 213 The Docker client supports connecting to a remote daemon via SSH: 214 215 ```console 216 $ docker -H ssh://me@example.com:22 ps 217 $ docker -H ssh://me@example.com ps 218 $ docker -H ssh://example.com ps 219 ``` 220 221 To use SSH connection, you need to set up `ssh` so that it can reach the 222 remote host with public key authentication. Password authentication is not 223 supported. If your key is protected with passphrase, you need to set up 224 `ssh-agent`. 225 226 #### Bind Docker to another host/port or a Unix socket 227 228 > **Warning** 229 > 230 > Changing the default `docker` daemon binding to a 231 > TCP port or Unix *docker* user group will increase your security risks 232 > by allowing non-root users to gain *root* access on the host. Make sure 233 > you control access to `docker`. If you are binding 234 > to a TCP port, anyone with access to that port has full Docker access; 235 > so it is not advisable on an open network. 236 {: .warning :} 237 238 With `-H` it is possible to make the Docker daemon to listen on a 239 specific IP and port. By default, it will listen on 240 `unix:///var/run/docker.sock` to allow only local connections by the 241 *root* user. You *could* set it to `0.0.0.0:2375` or a specific host IP 242 to give access to everybody, but that is **not recommended** because 243 then it is trivial for someone to gain root access to the host where the 244 daemon is running. 245 246 Similarly, the Docker client can use `-H` to connect to a custom port. 247 The Docker client will default to connecting to `unix:///var/run/docker.sock` 248 on Linux, and `tcp://127.0.0.1:2376` on Windows. 249 250 `-H` accepts host and port assignment in the following format: 251 252 tcp://[host]:[port][path] or unix://path 253 254 For example: 255 256 - `tcp://` -> TCP connection to `127.0.0.1` on either port `2376` when TLS encryption 257 is on, or port `2375` when communication is in plain text. 258 - `tcp://host:2375` -> TCP connection on 259 host:2375 260 - `tcp://host:2375/path` -> TCP connection on 261 host:2375 and prepend path to all requests 262 - `unix://path/to/socket` -> Unix socket located 263 at `path/to/socket` 264 265 `-H`, when empty, will default to the same value as 266 when no `-H` was passed in. 267 268 `-H` also accepts short form for TCP bindings: `host:` or `host:port` or `:port` 269 270 Run Docker in daemon mode: 271 272 ```console 273 $ sudo <path to>/dockerd -H 0.0.0.0:5555 & 274 ``` 275 276 Download an `ubuntu` image: 277 278 ```console 279 $ docker -H :5555 pull ubuntu 280 ``` 281 282 You can use multiple `-H`, for example, if you want to listen on both 283 TCP and a Unix socket 284 285 ```console 286 $ sudo dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock & 287 # Download an ubuntu image, use default Unix socket 288 $ docker pull ubuntu 289 # OR use the TCP port 290 $ docker -H tcp://127.0.0.1:2375 pull ubuntu 291 ``` 292 293 ### Daemon storage-driver 294 295 On Linux, the Docker daemon has support for several different image layer storage 296 drivers: `aufs`, `devicemapper`, `btrfs`, `zfs`, `overlay`, `overlay2`, and `fuse-overlayfs`. 297 298 `overlay2` is the preferred storage driver for all currently supported Linux distributions, 299 and is selected by default. Unless users have a strong reason to prefer another storage driver, 300 `overlay2` should be used. 301 302 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/). 303 304 On Windows, the Docker daemon only supports the `windowsfilter` storage driver. 305 306 ### Options per storage driver 307 308 Particular storage-driver can be configured with options specified with 309 `--storage-opt` flags. Options for `devicemapper` are prefixed with `dm`, 310 options for `zfs` start with `zfs`, and options for `btrfs` start with `btrfs`. 311 312 #### Devicemapper options 313 314 This is an example of the configuration file for devicemapper on Linux: 315 316 ```json 317 { 318 "storage-driver": "devicemapper", 319 "storage-opts": [ 320 "dm.thinpooldev=/dev/mapper/thin-pool", 321 "dm.use_deferred_deletion=true", 322 "dm.use_deferred_removal=true" 323 ] 324 } 325 ``` 326 327 ##### `dm.thinpooldev` 328 329 Specifies a custom block storage device to use for the thin pool. 330 331 If using a block device for device mapper storage, it is best to use `lvm` 332 to create and manage the thin-pool volume. This volume is then handed to Docker 333 to exclusively create snapshot volumes needed for images and containers. 334 335 Managing the thin-pool outside of Engine makes for the most feature-rich 336 method of having Docker utilize device mapper thin provisioning as the 337 backing storage for Docker containers. The highlights of the lvm-based 338 thin-pool management feature include: automatic or interactive thin-pool 339 resize support, dynamically changing thin-pool features, automatic thinp 340 metadata checking when lvm activates the thin-pool, etc. 341 342 As a fallback if no thin pool is provided, loopback files are 343 created. Loopback is very slow, but can be used without any 344 pre-configuration of storage. It is strongly recommended that you do 345 not use loopback in production. Ensure your Engine daemon has a 346 `--storage-opt dm.thinpooldev` argument provided. 347 348 ###### Example: 349 350 ```console 351 $ sudo dockerd --storage-opt dm.thinpooldev=/dev/mapper/thin-pool 352 ``` 353 354 ##### `dm.directlvm_device` 355 356 As an alternative to providing a thin pool as above, Docker can setup a block 357 device for you. 358 359 ###### Example: 360 361 ```console 362 $ sudo dockerd --storage-opt dm.directlvm_device=/dev/xvdf 363 ``` 364 365 ##### `dm.thinp_percent` 366 367 Sets the percentage of passed in block device to use for storage. 368 369 ###### Example: 370 371 ```console 372 $ sudo dockerd --storage-opt dm.thinp_percent=95 373 ``` 374 375 ##### `dm.thinp_metapercent` 376 377 Sets the percentage of the passed in block device to use for metadata storage. 378 379 ###### Example: 380 381 ```console 382 $ sudo dockerd --storage-opt dm.thinp_metapercent=1 383 ``` 384 385 ##### `dm.thinp_autoextend_threshold` 386 387 Sets the value of the percentage of space used before `lvm` attempts to 388 autoextend the available space [100 = disabled] 389 390 ###### Example: 391 392 ```console 393 $ sudo dockerd --storage-opt dm.thinp_autoextend_threshold=80 394 ``` 395 396 ##### `dm.thinp_autoextend_percent` 397 398 Sets the value percentage value to increase the thin pool by when `lvm` 399 attempts to autoextend the available space [100 = disabled] 400 401 ###### Example: 402 403 ```console 404 $ sudo dockerd --storage-opt dm.thinp_autoextend_percent=20 405 ``` 406 407 408 ##### `dm.basesize` 409 410 Specifies the size to use when creating the base device, which limits the 411 size of images and containers. The default value is 10G. Note, thin devices 412 are inherently "sparse", so a 10G device which is mostly empty doesn't use 413 10 GB of space on the pool. However, the filesystem will use more space for 414 the empty case the larger the device is. 415 416 The base device size can be increased at daemon restart which will allow 417 all future images and containers (based on those new images) to be of the 418 new base device size. 419 420 ###### Examples 421 422 ```console 423 $ sudo dockerd --storage-opt dm.basesize=50G 424 ``` 425 426 This will increase the base device size to 50G. The Docker daemon will throw an 427 error if existing base device size is larger than 50G. A user can use 428 this option to expand the base device size however shrinking is not permitted. 429 430 This value affects the system-wide "base" empty filesystem 431 that may already be initialized and inherited by pulled images. Typically, 432 a change to this value requires additional steps to take effect: 433 434 ```console 435 $ sudo service docker stop 436 437 $ sudo rm -rf /var/lib/docker 438 439 $ sudo service docker start 440 ``` 441 442 443 ##### `dm.loopdatasize` 444 445 > **Note** 446 > 447 > This option configures devicemapper loopback, which should not 448 > be used in production. 449 450 Specifies the size to use when creating the loopback file for the 451 "data" device which is used for the thin pool. The default size is 452 100G. The file is sparse, so it will not initially take up this 453 much space. 454 455 ###### Example 456 457 ```console 458 $ sudo dockerd --storage-opt dm.loopdatasize=200G 459 ``` 460 461 ##### `dm.loopmetadatasize` 462 463 > **Note** 464 > 465 > This option configures devicemapper loopback, which should not 466 > be used in production. 467 468 Specifies the size to use when creating the loopback file for the 469 "metadata" device which is used for the thin pool. The default size 470 is 2G. The file is sparse, so it will not initially take up 471 this much space. 472 473 ###### Example 474 475 ```console 476 $ sudo dockerd --storage-opt dm.loopmetadatasize=4G 477 ``` 478 479 ##### `dm.fs` 480 481 Specifies the filesystem type to use for the base device. The supported 482 options are "ext4" and "xfs". The default is "xfs" 483 484 ###### Example 485 486 ```console 487 $ sudo dockerd --storage-opt dm.fs=ext4 488 ``` 489 490 ##### `dm.mkfsarg` 491 492 Specifies extra mkfs arguments to be used when creating the base device. 493 494 ###### Example 495 496 ```console 497 $ sudo dockerd --storage-opt "dm.mkfsarg=-O ^has_journal" 498 ``` 499 500 ##### `dm.mountopt` 501 502 Specifies extra mount options used when mounting the thin devices. 503 504 ###### Example 505 506 ```console 507 $ sudo dockerd --storage-opt dm.mountopt=nodiscard 508 ``` 509 510 ##### `dm.datadev` 511 512 (Deprecated, use `dm.thinpooldev`) 513 514 Specifies a custom blockdevice to use for data for the thin pool. 515 516 If using a block device for device mapper storage, ideally both `datadev` and 517 `metadatadev` should be specified to completely avoid using the loopback 518 device. 519 520 ###### Example 521 522 ```console 523 $ sudo dockerd \ 524 --storage-opt dm.datadev=/dev/sdb1 \ 525 --storage-opt dm.metadatadev=/dev/sdc1 526 ``` 527 528 ##### `dm.metadatadev` 529 530 (Deprecated, use `dm.thinpooldev`) 531 532 Specifies a custom blockdevice to use for metadata for the thin pool. 533 534 For best performance the metadata should be on a different spindle than the 535 data, or even better on an SSD. 536 537 If setting up a new metadata pool it is required to be valid. This can be 538 achieved by zeroing the first 4k to indicate empty metadata, like this: 539 540 ```console 541 $ dd if=/dev/zero of=$metadata_dev bs=4096 count=1 542 ``` 543 544 ###### Example 545 546 ```console 547 $ sudo dockerd \ 548 --storage-opt dm.datadev=/dev/sdb1 \ 549 --storage-opt dm.metadatadev=/dev/sdc1 550 ``` 551 552 ##### `dm.blocksize` 553 554 Specifies a custom blocksize to use for the thin pool. The default 555 blocksize is 64K. 556 557 ###### Example 558 559 ```console 560 $ sudo dockerd --storage-opt dm.blocksize=512K 561 ``` 562 563 ##### `dm.blkdiscard` 564 565 Enables or disables the use of `blkdiscard` when removing devicemapper 566 devices. This is enabled by default (only) if using loopback devices and is 567 required to resparsify the loopback file on image/container removal. 568 569 Disabling this on loopback can lead to *much* faster container removal 570 times, but will make the space used in `/var/lib/docker` directory not be 571 returned to the system for other use when containers are removed. 572 573 ###### Examples 574 575 ```console 576 $ sudo dockerd --storage-opt dm.blkdiscard=false 577 ``` 578 579 ##### `dm.override_udev_sync_check` 580 581 Overrides the `udev` synchronization checks between `devicemapper` and `udev`. 582 `udev` is the device manager for the Linux kernel. 583 584 To view the `udev` sync support of a Docker daemon that is using the 585 `devicemapper` driver, run: 586 587 ```console 588 $ docker info 589 <...> 590 Udev Sync Supported: true 591 <...> 592 ``` 593 594 When `udev` sync support is `true`, then `devicemapper` and udev can 595 coordinate the activation and deactivation of devices for containers. 596 597 When `udev` sync support is `false`, a race condition occurs between 598 the`devicemapper` and `udev` during create and cleanup. The race condition 599 results in errors and failures. (For information on these failures, see 600 [docker#4036](https://github.com/docker/docker/issues/4036)) 601 602 To allow the `docker` daemon to start, regardless of `udev` sync not being 603 supported, set `dm.override_udev_sync_check` to true: 604 605 ```console 606 $ sudo dockerd --storage-opt dm.override_udev_sync_check=true 607 ``` 608 609 When this value is `true`, the `devicemapper` continues and simply warns 610 you the errors are happening. 611 612 > **Note** 613 > 614 > The ideal is to pursue a `docker` daemon and environment that does 615 > support synchronizing with `udev`. For further discussion on this 616 > topic, see [docker#4036](https://github.com/docker/docker/issues/4036). 617 > Otherwise, set this flag for migrating existing Docker daemons to 618 > a daemon with a supported environment. 619 620 ##### `dm.use_deferred_removal` 621 622 Enables use of deferred device removal if `libdm` and the kernel driver 623 support the mechanism. 624 625 Deferred device removal means that if device is busy when devices are 626 being removed/deactivated, then a deferred removal is scheduled on 627 device. And devices automatically go away when last user of the device 628 exits. 629 630 For example, when a container exits, its associated thin device is removed. 631 If that device has leaked into some other mount namespace and can't be 632 removed, the container exit still succeeds and this option causes the 633 system to schedule the device for deferred removal. It does not wait in a 634 loop trying to remove a busy device. 635 636 ###### Example 637 638 ```console 639 $ sudo dockerd --storage-opt dm.use_deferred_removal=true 640 ``` 641 642 ##### `dm.use_deferred_deletion` 643 644 Enables use of deferred device deletion for thin pool devices. By default, 645 thin pool device deletion is synchronous. Before a container is deleted, 646 the Docker daemon removes any associated devices. If the storage driver 647 can not remove a device, the container deletion fails and daemon returns. 648 649 ```console 650 Error deleting container: Error response from daemon: Cannot destroy container 651 ``` 652 653 To avoid this failure, enable both deferred device deletion and deferred 654 device removal on the daemon. 655 656 ```console 657 $ sudo dockerd \ 658 --storage-opt dm.use_deferred_deletion=true \ 659 --storage-opt dm.use_deferred_removal=true 660 ``` 661 662 With these two options enabled, if a device is busy when the driver is 663 deleting a container, the driver marks the device as deleted. Later, when 664 the device isn't in use, the driver deletes it. 665 666 In general it should be safe to enable this option by default. It will help 667 when unintentional leaking of mount point happens across multiple mount 668 namespaces. 669 670 ##### `dm.min_free_space` 671 672 Specifies the min free space percent in a thin pool require for new device 673 creation to succeed. This check applies to both free data space as well 674 as free metadata space. Valid values are from 0% - 99%. Value 0% disables 675 free space checking logic. If user does not specify a value for this option, 676 the Engine uses a default value of 10%. 677 678 Whenever a new a thin pool device is created (during `docker pull` or during 679 container creation), the Engine checks if the minimum free space is 680 available. If sufficient space is unavailable, then device creation fails 681 and any relevant `docker` operation fails. 682 683 To recover from this error, you must create more free space in the thin pool 684 to recover from the error. You can create free space by deleting some images 685 and containers from the thin pool. You can also add more storage to the thin 686 pool. 687 688 To add more space to a LVM (logical volume management) thin pool, just add 689 more storage to the volume group container thin pool; this should automatically 690 resolve any errors. If your configuration uses loop devices, then stop the 691 Engine daemon, grow the size of loop files and restart the daemon to resolve 692 the issue. 693 694 ###### Example 695 696 ```console 697 $ sudo dockerd --storage-opt dm.min_free_space=10% 698 ``` 699 700 ##### `dm.xfs_nospace_max_retries` 701 702 Specifies the maximum number of retries XFS should attempt to complete 703 IO when ENOSPC (no space) error is returned by underlying storage device. 704 705 By default XFS retries infinitely for IO to finish and this can result 706 in unkillable process. To change this behavior one can set 707 xfs_nospace_max_retries to say 0 and XFS will not retry IO after getting 708 ENOSPC and will shutdown filesystem. 709 710 ###### Example 711 712 ```console 713 $ sudo dockerd --storage-opt dm.xfs_nospace_max_retries=0 714 ``` 715 716 ##### `dm.libdm_log_level` 717 718 Specifies the maxmimum `libdm` log level that will be forwarded to the 719 `dockerd` log (as specified by `--log-level`). This option is primarily 720 intended for debugging problems involving `libdm`. Using values other than the 721 defaults may cause false-positive warnings to be logged. 722 723 Values specified must fall within the range of valid `libdm` log levels. At the 724 time of writing, the following is the list of `libdm` log levels as well as 725 their corresponding levels when output by `dockerd`. 726 727 | `libdm` Level | Value | `--log-level` | 728 |---------------|------:|---------------| 729 | `_LOG_FATAL` | 2 | error | 730 | `_LOG_ERR` | 3 | error | 731 | `_LOG_WARN` | 4 | warn | 732 | `_LOG_NOTICE` | 5 | info | 733 | `_LOG_INFO` | 6 | info | 734 | `_LOG_DEBUG` | 7 | debug | 735 736 ###### Example 737 738 ```console 739 $ sudo dockerd \ 740 --log-level debug \ 741 --storage-opt dm.libdm_log_level=7 742 ``` 743 744 #### ZFS options 745 746 ##### `zfs.fsname` 747 748 Set zfs filesystem under which docker will create its own datasets. 749 By default docker will pick up the zfs filesystem where docker graph 750 (`/var/lib/docker`) is located. 751 752 ###### Example 753 754 ```console 755 $ sudo dockerd -s zfs --storage-opt zfs.fsname=zroot/docker 756 ``` 757 758 #### Btrfs options 759 760 ##### `btrfs.min_space` 761 762 Specifies the minimum size to use when creating the subvolume which is used 763 for containers. If user uses disk quota for btrfs when creating or running 764 a container with **--storage-opt size** option, docker should ensure the 765 **size** cannot be smaller than **btrfs.min_space**. 766 767 ###### Example 768 769 ```console 770 $ sudo dockerd -s btrfs --storage-opt btrfs.min_space=10G 771 ``` 772 773 #### Overlay2 options 774 775 ##### `overlay2.size` 776 777 Sets the default max size of the container. It is supported only when the 778 backing fs is `xfs` and mounted with `pquota` mount option. Under these 779 conditions the user can pass any size less than the backing fs size. 780 781 ###### Example 782 783 ```console 784 $ sudo dockerd -s overlay2 --storage-opt overlay2.size=1G 785 ``` 786 787 788 #### Windowsfilter options 789 790 ##### `size` 791 792 Specifies the size to use when creating the sandbox which is used for containers. 793 Defaults to 20G. 794 795 ###### Example 796 797 ```powershell 798 C:\> dockerd --storage-opt size=40G 799 ``` 800 801 ### Docker runtime execution options 802 803 The Docker daemon relies on a 804 [OCI](https://github.com/opencontainers/runtime-spec) compliant runtime 805 (invoked via the `containerd` daemon) as its interface to the Linux 806 kernel `namespaces`, `cgroups`, and `SELinux`. 807 808 By default, the Docker daemon automatically starts `containerd`. If you want to 809 control `containerd` startup, manually start `containerd` and pass the path to 810 the `containerd` socket using the `--containerd` flag. For example: 811 812 ```console 813 $ sudo dockerd --containerd /var/run/dev/docker-containerd.sock 814 ``` 815 816 Runtimes can be registered with the daemon either via the 817 configuration file or using the `--add-runtime` command line argument. 818 819 The following is an example adding 2 runtimes via the configuration: 820 821 ```json 822 { 823 "default-runtime": "runc", 824 "runtimes": { 825 "custom": { 826 "path": "/usr/local/bin/my-runc-replacement", 827 "runtimeArgs": [ 828 "--debug" 829 ] 830 }, 831 "runc": { 832 "path": "runc" 833 } 834 } 835 } 836 ``` 837 838 This is the same example via the command line: 839 840 ```console 841 $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-runc-replacement 842 ``` 843 844 > **Note** 845 > 846 > Defining runtime arguments via the command line is not supported. 847 848 #### Options for the runtime 849 850 You can configure the runtime using options specified 851 with the `--exec-opt` flag. All the flag's options have the `native` prefix. A 852 single `native.cgroupdriver` option is available. 853 854 The `native.cgroupdriver` option specifies the management of the container's 855 cgroups. You can only specify `cgroupfs` or `systemd`. If you specify 856 `systemd` and it is not available, the system errors out. If you omit the 857 `native.cgroupdriver` option,` cgroupfs` is used on cgroup v1 hosts, `systemd` 858 is used on cgroup v2 hosts with systemd available. 859 860 This example sets the `cgroupdriver` to `systemd`: 861 862 ```console 863 $ sudo dockerd --exec-opt native.cgroupdriver=systemd 864 ``` 865 866 Setting this option applies to all containers the daemon launches. 867 868 Also Windows Container makes use of `--exec-opt` for special purpose. Docker user 869 can specify default container isolation technology with this, for example: 870 871 ```console 872 > dockerd --exec-opt isolation=hyperv 873 ``` 874 875 Will make `hyperv` the default isolation technology on Windows. If no isolation 876 value is specified on daemon start, on Windows client, the default is 877 `hyperv`, and on Windows server, the default is `process`. 878 879 ### Daemon DNS options 880 881 To set the DNS server for all Docker containers, use: 882 883 ```console 884 $ sudo dockerd --dns 8.8.8.8 885 ``` 886 887 To set the DNS search domain for all Docker containers, use: 888 889 ```console 890 $ sudo dockerd --dns-search example.com 891 ``` 892 893 ### Allow push of nondistributable artifacts 894 895 Some images (e.g., Windows base images) contain artifacts whose distribution is 896 restricted by license. When these images are pushed to a registry, restricted 897 artifacts are not included. 898 899 To override this behavior for specific registries, use the 900 `--allow-nondistributable-artifacts` option in one of the following forms: 901 902 * `--allow-nondistributable-artifacts myregistry:5000` tells the Docker daemon 903 to push nondistributable artifacts to myregistry:5000. 904 * `--allow-nondistributable-artifacts 10.1.0.0/16` tells the Docker daemon to 905 push nondistributable artifacts to all registries whose resolved IP address 906 is within the subnet described by the CIDR syntax. 907 908 This option can be used multiple times. 909 910 This option is useful when pushing images containing nondistributable artifacts 911 to a registry on an air-gapped network so hosts on that network can pull the 912 images without connecting to another server. 913 914 > **Warning**: Nondistributable artifacts typically have restrictions on how 915 > and where they can be distributed and shared. Only use this feature to push 916 > artifacts to private registries and ensure that you are in compliance with 917 > any terms that cover redistributing nondistributable artifacts. 918 919 ### Insecure registries 920 921 Docker considers a private registry either secure or insecure. In the rest of 922 this section, *registry* is used for *private registry*, and `myregistry:5000` 923 is a placeholder example for a private registry. 924 925 A secure registry uses TLS and a copy of its CA certificate is placed on the 926 Docker host at `/etc/docker/certs.d/myregistry:5000/ca.crt`. An insecure 927 registry is either not using TLS (i.e., listening on plain text HTTP), or is 928 using TLS with a CA certificate not known by the Docker daemon. The latter can 929 happen when the certificate was not found under 930 `/etc/docker/certs.d/myregistry:5000/`, or if the certificate verification 931 failed (i.e., wrong CA). 932 933 By default, Docker assumes all, but local (see local registries below), 934 registries are secure. Communicating with an insecure registry is not possible 935 if Docker assumes that registry is secure. In order to communicate with an 936 insecure registry, the Docker daemon requires `--insecure-registry` in one of 937 the following two forms: 938 939 * `--insecure-registry myregistry:5000` tells the Docker daemon that 940 myregistry:5000 should be considered insecure. 941 * `--insecure-registry 10.1.0.0/16` tells the Docker daemon that all registries 942 whose domain resolve to an IP address is part of the subnet described by the 943 CIDR syntax, should be considered insecure. 944 945 The flag can be used multiple times to allow multiple registries to be marked 946 as insecure. 947 948 If an insecure registry is not marked as insecure, `docker pull`, 949 `docker push`, and `docker search` will result in an error message prompting 950 the user to either secure or pass the `--insecure-registry` flag to the Docker 951 daemon as described above. 952 953 Local registries, whose IP address falls in the 127.0.0.0/8 range, are 954 automatically marked as insecure as of Docker 1.3.2. It is not recommended to 955 rely on this, as it may change in the future. 956 957 Enabling `--insecure-registry`, i.e., allowing un-encrypted and/or untrusted 958 communication, can be useful when running a local registry. However, 959 because its use creates security vulnerabilities it should ONLY be enabled for 960 testing purposes. For increased security, users should add their CA to their 961 system's list of trusted CAs instead of enabling `--insecure-registry`. 962 963 #### Legacy Registries 964 965 Operations against registries supporting only the legacy v1 protocol are no longer 966 supported. Specifically, the daemon will not attempt `push`, `pull` and `login` 967 to v1 registries. The exception to this is `search` which can still be performed 968 on v1 registries. 969 970 971 ### Running a Docker daemon behind an HTTPS_PROXY 972 973 When running inside a LAN that uses an `HTTPS` proxy, the Docker Hub 974 certificates will be replaced by the proxy's certificates. These certificates 975 need to be added to your Docker host's configuration: 976 977 1. Install the `ca-certificates` package for your distribution 978 2. Ask your network admin for the proxy's CA certificate and append them to 979 `/etc/pki/tls/certs/ca-bundle.crt` 980 3. Then start your Docker daemon with `HTTPS_PROXY=http://username:password@proxy:port/ dockerd`. 981 The `username:` and `password@` are optional - and are only needed if your 982 proxy is set up to require authentication. 983 984 This will only add the proxy and authentication to the Docker daemon's requests - 985 your `docker build`s and running containers will need extra configuration to 986 use the proxy 987 988 ### Default `ulimit` settings 989 990 `--default-ulimit` allows you to set the default `ulimit` options to use for 991 all containers. It takes the same options as `--ulimit` for `docker run`. If 992 these defaults are not set, `ulimit` settings will be inherited, if not set on 993 `docker run`, from the Docker daemon. Any `--ulimit` options passed to 994 `docker run` will overwrite these defaults. 995 996 Be careful setting `nproc` with the `ulimit` flag as `nproc` is designed by Linux to 997 set the maximum number of processes available to a user, not to a container. For details 998 please check the [run](run.md) reference. 999 1000 ### Access authorization 1001 1002 Docker's access authorization can be extended by authorization plugins that your 1003 organization can purchase or build themselves. You can install one or more 1004 authorization plugins when you start the Docker `daemon` using the 1005 `--authorization-plugin=PLUGIN_ID` option. 1006 1007 ```console 1008 $ sudo dockerd --authorization-plugin=plugin1 --authorization-plugin=plugin2,... 1009 ``` 1010 1011 The `PLUGIN_ID` value is either the plugin's name or a path to its specification 1012 file. The plugin's implementation determines whether you can specify a name or 1013 path. Consult with your Docker administrator to get information about the 1014 plugins available to you. 1015 1016 Once a plugin is installed, requests made to the `daemon` through the 1017 command line or Docker's Engine API are allowed or denied by the plugin. 1018 If you have multiple plugins installed, each plugin, in order, must 1019 allow the request for it to complete. 1020 1021 For information about how to create an authorization plugin, refer to the 1022 [authorization plugin](../../extend/plugins_authorization.md) section. 1023 1024 1025 ### Daemon user namespace options 1026 1027 The Linux kernel 1028 [user namespace support](https://man7.org/linux/man-pages/man7/user_namespaces.7.html) 1029 provides additional security by enabling a process, and therefore a container, 1030 to have a unique range of user and group IDs which are outside the traditional 1031 user and group range utilized by the host system. Potentially the most important 1032 security improvement is that, by default, container processes running as the 1033 `root` user will have expected administrative privilege (with some restrictions) 1034 inside the container but will effectively be mapped to an unprivileged `uid` on 1035 the host. 1036 1037 For details about how to use this feature, as well as limitations, see 1038 [Isolate containers with a user namespace](https://docs.docker.com/engine/security/userns-remap/). 1039 1040 ### Miscellaneous options 1041 1042 IP masquerading uses address translation to allow containers without a public 1043 IP to talk to other machines on the Internet. This may interfere with some 1044 network topologies and can be disabled with `--ip-masq=false`. 1045 1046 Docker supports softlinks for the Docker data directory (`/var/lib/docker`) and 1047 for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be 1048 set like this: 1049 1050 ```console 1051 $ DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/dockerd --data-root /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 1052 ``` 1053 1054 or 1055 1056 ```console 1057 $ export DOCKER_TMPDIR=/mnt/disk2/tmp 1058 $ /usr/local/bin/dockerd --data-root /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 1059 ```` 1060 1061 #### Default cgroup parent 1062 1063 The `--cgroup-parent` option allows you to set the default cgroup parent 1064 to use for containers. If this option is not set, it defaults to `/docker` for 1065 fs cgroup driver and `system.slice` for systemd cgroup driver. 1066 1067 If the cgroup has a leading forward slash (`/`), the cgroup is created 1068 under the root cgroup, otherwise the cgroup is created under the daemon 1069 cgroup. 1070 1071 Assuming the daemon is running in cgroup `daemoncgroup`, 1072 `--cgroup-parent=/foobar` creates a cgroup in 1073 `/sys/fs/cgroup/memory/foobar`, whereas using `--cgroup-parent=foobar` 1074 creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar` 1075 1076 The systemd cgroup driver has different rules for `--cgroup-parent`. Systemd 1077 represents hierarchy by slice and the name of the slice encodes the location in 1078 the tree. So `--cgroup-parent` for systemd cgroups should be a slice name. A 1079 name can consist of a dash-separated series of names, which describes the path 1080 to the slice from the root slice. For example, `--cgroup-parent=user-a-b.slice` 1081 means the memory cgroup for the container is created in 1082 `/sys/fs/cgroup/memory/user.slice/user-a.slice/user-a-b.slice/docker-<id>.scope`. 1083 1084 This setting can also be set per container, using the `--cgroup-parent` 1085 option on `docker create` and `docker run`, and takes precedence over 1086 the `--cgroup-parent` option on the daemon. 1087 1088 #### Daemon metrics 1089 1090 The `--metrics-addr` option takes a tcp address to serve the metrics API. 1091 This feature is still experimental, therefore, the daemon must be running in experimental 1092 mode for this feature to work. 1093 1094 To serve the metrics API on `localhost:9323` you would specify `--metrics-addr 127.0.0.1:9323`, 1095 allowing you to make requests on the API at `127.0.0.1:9323/metrics` to receive metrics in the 1096 [prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) format. 1097 1098 Port `9323` is the [default port associated with Docker 1099 metrics](https://github.com/prometheus/prometheus/wiki/Default-port-allocations) 1100 to avoid collisions with other prometheus exporters and services. 1101 1102 If you are running a prometheus server you can add this address to your scrape configs 1103 to have prometheus collect metrics on Docker. For more information 1104 on prometheus refer to the [prometheus website](https://prometheus.io/). 1105 1106 ```yaml 1107 scrape_configs: 1108 - job_name: 'docker' 1109 static_configs: 1110 - targets: ['127.0.0.1:9323'] 1111 ``` 1112 1113 Please note that this feature is still marked as experimental as metrics and metric 1114 names could change while this feature is still in experimental. Please provide 1115 feedback on what you would like to see collected in the API. 1116 1117 #### Node Generic Resources 1118 1119 The `--node-generic-resources` option takes a list of key-value 1120 pair (`key=value`) that allows you to advertise user defined resources 1121 in a swarm cluster. 1122 1123 The current expected use case is to advertise NVIDIA GPUs so that services 1124 requesting `NVIDIA-GPU=[0-16]` can land on a node that has enough GPUs for 1125 the task to run. 1126 1127 Example of usage: 1128 ```json 1129 { 1130 "node-generic-resources": [ 1131 "NVIDIA-GPU=UUID1", 1132 "NVIDIA-GPU=UUID2" 1133 ] 1134 } 1135 ``` 1136 1137 ### Daemon configuration file 1138 1139 The `--config-file` option allows you to set any configuration option 1140 for the daemon in a JSON format. This file uses the same flag names as keys, 1141 except for flags that allow several entries, where it uses the plural 1142 of the flag name, e.g., `labels` for the `label` flag. 1143 1144 The options set in the configuration file must not conflict with options set 1145 via flags. The docker daemon fails to start if an option is duplicated between 1146 the file and the flags, regardless their value. We do this to avoid 1147 silently ignore changes introduced in configuration reloads. 1148 For example, the daemon fails to start if you set daemon labels 1149 in the configuration file and also set daemon labels via the `--label` flag. 1150 Options that are not present in the file are ignored when the daemon starts. 1151 1152 The `--validate` option allows to validate a configuration file without 1153 starting the Docker daemon. A non-zero exit code is returned for invalid 1154 configuration files. 1155 1156 ```console 1157 $ dockerd --validate --config-file=/tmp/valid-config.json 1158 configuration OK 1159 1160 $ echo $? 1161 0 1162 1163 $ dockerd --validate --config-file /tmp/invalid-config.json 1164 unable to configure the Docker daemon with file /tmp/invalid-config.json: the following directives don't match any configuration option: unknown-option 1165 1166 $ echo $? 1167 1 1168 ``` 1169 1170 1171 ##### On Linux 1172 1173 The default location of the configuration file on Linux is 1174 `/etc/docker/daemon.json`. The `--config-file` flag can be used to specify a 1175 non-default location. 1176 1177 This is a full example of the allowed configuration options on Linux: 1178 1179 ```json 1180 { 1181 "allow-nondistributable-artifacts": [], 1182 "api-cors-header": "", 1183 "authorization-plugins": [], 1184 "bip": "", 1185 "bridge": "", 1186 "cgroup-parent": "", 1187 "containerd": "/run/containerd/containerd.sock", 1188 "containerd-namespace": "docker", 1189 "containerd-plugin-namespace": "docker-plugins", 1190 "data-root": "", 1191 "debug": true, 1192 "default-address-pools": [ 1193 { 1194 "base": "172.30.0.0/16", 1195 "size": 24 1196 }, 1197 { 1198 "base": "172.31.0.0/16", 1199 "size": 24 1200 } 1201 ], 1202 "default-cgroupns-mode": "private", 1203 "default-gateway": "", 1204 "default-gateway-v6": "", 1205 "default-runtime": "runc", 1206 "default-shm-size": "64M", 1207 "default-ulimits": { 1208 "nofile": { 1209 "Hard": 64000, 1210 "Name": "nofile", 1211 "Soft": 64000 1212 } 1213 }, 1214 "dns": [], 1215 "dns-opts": [], 1216 "dns-search": [], 1217 "exec-opts": [], 1218 "exec-root": "", 1219 "experimental": false, 1220 "features": {}, 1221 "fixed-cidr": "", 1222 "fixed-cidr-v6": "", 1223 "group": "", 1224 "hosts": [], 1225 "icc": false, 1226 "init": false, 1227 "init-path": "/usr/libexec/docker-init", 1228 "insecure-registries": [], 1229 "ip": "0.0.0.0", 1230 "ip-forward": false, 1231 "ip-masq": false, 1232 "iptables": false, 1233 "ip6tables": false, 1234 "ipv6": false, 1235 "labels": [], 1236 "live-restore": true, 1237 "log-driver": "json-file", 1238 "log-level": "", 1239 "log-opts": { 1240 "cache-disabled": "false", 1241 "cache-max-file": "5", 1242 "cache-max-size": "20m", 1243 "cache-compress": "true", 1244 "env": "os,customer", 1245 "labels": "somelabel", 1246 "max-file": "5", 1247 "max-size": "10m" 1248 }, 1249 "max-concurrent-downloads": 3, 1250 "max-concurrent-uploads": 5, 1251 "max-download-attempts": 5, 1252 "mtu": 0, 1253 "no-new-privileges": false, 1254 "node-generic-resources": [ 1255 "NVIDIA-GPU=UUID1", 1256 "NVIDIA-GPU=UUID2" 1257 ], 1258 "oom-score-adjust": -500, 1259 "pidfile": "", 1260 "raw-logs": false, 1261 "registry-mirrors": [], 1262 "runtimes": { 1263 "cc-runtime": { 1264 "path": "/usr/bin/cc-runtime" 1265 }, 1266 "custom": { 1267 "path": "/usr/local/bin/my-runc-replacement", 1268 "runtimeArgs": [ 1269 "--debug" 1270 ] 1271 } 1272 }, 1273 "seccomp-profile": "", 1274 "selinux-enabled": false, 1275 "shutdown-timeout": 15, 1276 "storage-driver": "", 1277 "storage-opts": [], 1278 "swarm-default-advertise-addr": "", 1279 "tls": true, 1280 "tlscacert": "", 1281 "tlscert": "", 1282 "tlskey": "", 1283 "tlsverify": true, 1284 "userland-proxy": false, 1285 "userland-proxy-path": "/usr/libexec/docker-proxy", 1286 "userns-remap": "" 1287 } 1288 ``` 1289 1290 > **Note:** 1291 > 1292 > You cannot set options in `daemon.json` that have already been set on 1293 > daemon startup as a flag. 1294 > On systems that use `systemd` to start the Docker daemon, `-H` is already set, so 1295 > you cannot use the `hosts` key in `daemon.json` to add listening addresses. 1296 > See ["custom Docker daemon options"](https://docs.docker.com/config/daemon/systemd/#custom-docker-daemon-options) for how 1297 > to accomplish this task with a systemd drop-in file. 1298 1299 ##### On Windows 1300 1301 The default location of the configuration file on Windows is 1302 `%programdata%\docker\config\daemon.json`. The `--config-file` flag can be 1303 used to specify a non-default location. 1304 1305 This is a full example of the allowed configuration options on Windows: 1306 1307 ```json 1308 { 1309 "allow-nondistributable-artifacts": [], 1310 "authorization-plugins": [], 1311 "bridge": "", 1312 "containerd": "\\\\.\\pipe\\containerd-containerd", 1313 "containerd-namespace": "docker", 1314 "containerd-plugin-namespace": "docker-plugins", 1315 "data-root": "", 1316 "debug": true, 1317 "default-runtime": "", 1318 "default-ulimits": {}, 1319 "dns": [], 1320 "dns-opts": [], 1321 "dns-search": [], 1322 "exec-opts": [], 1323 "experimental": false, 1324 "features": {}, 1325 "fixed-cidr": "", 1326 "group": "", 1327 "hosts": [], 1328 "insecure-registries": [], 1329 "labels": [], 1330 "log-driver": "", 1331 "log-level": "", 1332 "max-concurrent-downloads": 3, 1333 "max-concurrent-uploads": 5, 1334 "max-download-attempts": 5, 1335 "mtu": 0, 1336 "pidfile": "", 1337 "raw-logs": false, 1338 "registry-mirrors": [], 1339 "shutdown-timeout": 15, 1340 "storage-driver": "", 1341 "storage-opts": [], 1342 "swarm-default-advertise-addr": "", 1343 "tlscacert": "", 1344 "tlscert": "", 1345 "tlskey": "", 1346 "tlsverify": true 1347 } 1348 ``` 1349 1350 The `default-runtime` option is by default unset, in which case dockerd will auto-detect the runtime. This detection is currently based on if the `containerd` flag is set. 1351 1352 Accepted values: 1353 1354 - `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. 1355 - `io.containerd.runhcs.v1` - This is uses the containerd `runhcs` shim to run the container and uses the v2 HCS API's in Windows. 1356 1357 #### Feature options 1358 The optional field `features` in `daemon.json` allows users to enable or disable specific 1359 daemon features. For example, `{"features":{"buildkit": true}}` enables `buildkit` as the 1360 default docker image builder. 1361 1362 The list of currently supported feature options: 1363 - `buildkit`: It enables `buildkit` as default builder when set to `true` or disables it by 1364 `false`. Note that if this option is not explicitly set in the daemon config file, then it 1365 is up to the cli to determine which builder to invoke. 1366 1367 #### Configuration reload behavior 1368 1369 Some options can be reconfigured when the daemon is running without requiring 1370 to restart the process. We use the `SIGHUP` signal in Linux to reload, and a global event 1371 in Windows with the key `Global\docker-daemon-config-$PID`. The options can 1372 be modified in the configuration file but still will check for conflicts with 1373 the provided flags. The daemon fails to reconfigure itself 1374 if there are conflicts, but it won't stop execution. 1375 1376 The list of currently supported options that can be reconfigured is this: 1377 1378 - `debug`: it changes the daemon to debug mode when set to true. 1379 - `labels`: it replaces the daemon labels with a new set of labels. 1380 - `live-restore`: Enables [keeping containers alive during daemon downtime](https://docs.docker.com/config/containers/live-restore/). 1381 - `max-concurrent-downloads`: it updates the max concurrent downloads for each pull. 1382 - `max-concurrent-uploads`: it updates the max concurrent uploads for each push. 1383 - `max-download-attempts`: it updates the max download attempts for each pull. 1384 - `default-runtime`: it updates the runtime to be used if not is 1385 specified at container creation. It defaults to "default" which is 1386 the runtime shipped with the official docker packages. 1387 - `runtimes`: it updates the list of available OCI runtimes that can 1388 be used to run containers. 1389 - `authorization-plugin`: it specifies the authorization plugins to use. 1390 - `allow-nondistributable-artifacts`: Replaces the set of registries to which the daemon will push nondistributable artifacts with a new set of registries. 1391 - `insecure-registries`: it replaces the daemon insecure registries with a new set of insecure registries. If some existing insecure registries in daemon's configuration are not in newly reloaded insecure registries, these existing ones will be removed from daemon's config. 1392 - `registry-mirrors`: it replaces the daemon registry mirrors with a new set of registry mirrors. If some existing registry mirrors in daemon's configuration are not in newly reloaded registry mirrors, these existing ones will be removed from daemon's config. 1393 - `shutdown-timeout`: it replaces the daemon's existing configuration timeout with a new timeout for shutting down all containers. 1394 - `features`: it explicitly enables or disables specific features. 1395 1396 ### Run multiple daemons 1397 1398 > **Note:** 1399 > 1400 > Running multiple daemons on a single host is considered as "experimental". The user should be aware of 1401 > unsolved problems. This solution may not work properly in some cases. Solutions are currently under development 1402 > and will be delivered in the near future. 1403 1404 This section describes how to run multiple Docker daemons on a single host. To 1405 run multiple daemons, you must configure each daemon so that it does not 1406 conflict with other daemons on the same host. You can set these options either 1407 by providing them as flags, or by using a [daemon configuration file](#daemon-configuration-file). 1408 1409 The following daemon options must be configured for each daemon: 1410 1411 ```console 1412 -b, --bridge= Attach containers to a network bridge 1413 --exec-root=/var/run/docker Root of the Docker execdriver 1414 --data-root=/var/lib/docker Root of persisted Docker data 1415 -p, --pidfile=/var/run/docker.pid Path to use for daemon PID file 1416 -H, --host=[] Daemon socket(s) to connect to 1417 --iptables=true Enable addition of iptables rules 1418 --config-file=/etc/docker/daemon.json Daemon configuration file 1419 --tlscacert="~/.docker/ca.pem" Trust certs signed only by this CA 1420 --tlscert="~/.docker/cert.pem" Path to TLS certificate file 1421 --tlskey="~/.docker/key.pem" Path to TLS key file 1422 ``` 1423 1424 When your daemons use different values for these flags, you can run them on the same host without any problems. 1425 It is very important to properly understand the meaning of those options and to use them correctly. 1426 1427 - The `-b, --bridge=` flag is set to `docker0` as default bridge network. It is created automatically when you install Docker. 1428 If you are not using the default, you must create and configure the bridge manually or just set it to 'none': `--bridge=none` 1429 - `--exec-root` is the path where the container state is stored. The default value is `/var/run/docker`. Specify the path for 1430 your running daemon here. 1431 - `--data-root` is the path where persisted data such as images, volumes, and 1432 cluster state are stored. The default value is `/var/lib/docker`. To avoid any 1433 conflict with other daemons, set this parameter separately for each daemon. 1434 - `-p, --pidfile=/var/run/docker.pid` is the path where the process ID of the daemon is stored. Specify the path for your 1435 pid file here. 1436 - `--host=[]` specifies where the Docker daemon will listen for client connections. If unspecified, it defaults to `/var/run/docker.sock`. 1437 - `--iptables=false` prevents the Docker daemon from adding iptables rules. If 1438 multiple daemons manage iptables rules, they may overwrite rules set by another 1439 daemon. Be aware that disabling this option requires you to manually add 1440 iptables rules to expose container ports. If you prevent Docker from adding 1441 iptables rules, Docker will also not add IP masquerading rules, even if you set 1442 `--ip-masq` to `true`. Without IP masquerading rules, Docker containers will not be 1443 able to connect to external hosts or the internet when using network other than 1444 default bridge. 1445 - `--config-file=/etc/docker/daemon.json` is the path where configuration file is stored. You can use it instead of 1446 daemon flags. Specify the path for each daemon. 1447 - `--tls*` Docker daemon supports `--tlsverify` mode that enforces encrypted and authenticated remote connections. 1448 The `--tls*` options enable use of specific certificates for individual daemons. 1449 1450 Example script for a separate “bootstrap” instance of the Docker daemon without network: 1451 1452 ```console 1453 $ sudo dockerd \ 1454 -H unix:///var/run/docker-bootstrap.sock \ 1455 -p /var/run/docker-bootstrap.pid \ 1456 --iptables=false \ 1457 --ip-masq=false \ 1458 --bridge=none \ 1459 --data-root=/var/lib/docker-bootstrap \ 1460 --exec-root=/var/run/docker-bootstrap 1461 ```