github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/docs/reference/commandline/dockerd.md (about) 1 <!--[metadata]> 2 +++ 3 title = "dockerd" 4 aliases = ["/engine/reference/commandline/daemon/"] 5 description = "The daemon command description and usage" 6 keywords = ["container, daemon, runtime"] 7 [menu.main] 8 parent = "smn_cli" 9 weight = -1 10 +++ 11 <![end-metadata]--> 12 13 # daemon 14 15 ```markdown 16 Usage: dockerd [OPTIONS] 17 18 A self-sufficient runtime for containers. 19 20 Options: 21 22 --add-runtime=[] Register an additional OCI compatible runtime 23 --api-cors-header Set CORS headers in the remote API 24 --authorization-plugin=[] Authorization plugins to load 25 -b, --bridge Attach containers to a network bridge 26 --bip Specify network bridge IP 27 --cgroup-parent Set parent cgroup for all containers 28 --cluster-advertise Address or interface name to advertise 29 --cluster-store URL of the distributed storage backend 30 --cluster-store-opt=map[] Set cluster store options 31 --config-file=/etc/docker/daemon.json Daemon configuration file 32 --containerd Path to containerd socket 33 -D, --debug Enable debug mode 34 --default-gateway Container default gateway IPv4 address 35 --default-gateway-v6 Container default gateway IPv6 address 36 --default-runtime=runc Default OCI runtime for containers 37 --default-ulimit=[] Default ulimits for containers 38 --disable-legacy-registry Disable contacting legacy registries 39 --dns=[] DNS server to use 40 --dns-opt=[] DNS options to use 41 --dns-search=[] DNS search domains to use 42 --exec-opt=[] Runtime execution options 43 --exec-root=/var/run/docker Root directory for execution state files 44 --fixed-cidr IPv4 subnet for fixed IPs 45 --fixed-cidr-v6 IPv6 subnet for fixed IPs 46 -G, --group=docker Group for the unix socket 47 -g, --graph=/var/lib/docker Root of the Docker runtime 48 -H, --host=[] Daemon socket(s) to connect to 49 --help Print usage 50 --icc=true Enable inter-container communication 51 --init Run an init inside containers to forward signals and reap processes 52 --init-path Path to the docker-init binary 53 --insecure-registry=[] Enable insecure registry communication 54 --ip=0.0.0.0 Default IP when binding container ports 55 --ip-forward=true Enable net.ipv4.ip_forward 56 --ip-masq=true Enable IP masquerading 57 --iptables=true Enable addition of iptables rules 58 --ipv6 Enable IPv6 networking 59 -l, --log-level=info Set the logging level 60 --label=[] Set key=value labels to the daemon 61 --live-restore Enables keeping containers alive during daemon downtime 62 --log-driver=json-file Default driver for container logs 63 --log-opt=map[] Default log driver options for containers 64 --max-concurrent-downloads=3 Set the max concurrent downloads for each pull 65 --max-concurrent-uploads=5 Set the max concurrent uploads for each push 66 --mtu Set the containers network MTU 67 --oom-score-adjust=-500 Set the oom_score_adj for the daemon 68 -p, --pidfile=/var/run/docker.pid Path to use for daemon PID file 69 --raw-logs Full timestamps without ANSI coloring 70 --registry-mirror=[] Preferred Docker registry mirror 71 -s, --storage-driver Storage driver to use 72 --selinux-enabled Enable selinux support 73 --storage-opt=[] Storage driver options 74 --swarm-default-advertise-addr Set default address or interface for swarm advertised address 75 --tls Use TLS; implied by --tlsverify 76 --tlscacert=~/.docker/ca.pem Trust certs signed only by this CA 77 --tlscert=~/.docker/cert.pem Path to TLS certificate file 78 --tlskey=~/.docker/key.pem Path to TLS key file 79 --tlsverify Use TLS and verify the remote 80 --userland-proxy=true Use userland proxy for loopback traffic 81 --userns-remap User/Group setting for user namespaces 82 -v, --version Print version information and quit 83 ``` 84 85 Options with [] may be specified multiple times. 86 87 dockerd is the persistent process that manages containers. Docker 88 uses different binaries for the daemon and client. To run the daemon you 89 type `dockerd`. 90 91 To run the daemon with debug output, use `dockerd -D`. 92 93 ## Daemon socket option 94 95 The Docker daemon can listen for [Docker Remote API](../api/docker_remote_api.md) 96 requests via three different types of Socket: `unix`, `tcp`, and `fd`. 97 98 By default, a `unix` domain socket (or IPC socket) is created at 99 `/var/run/docker.sock`, requiring either `root` permission, or `docker` group 100 membership. 101 102 If you need to access the Docker daemon remotely, you need to enable the `tcp` 103 Socket. Beware that the default setup provides un-encrypted and 104 un-authenticated direct access to the Docker daemon - and should be secured 105 either using the [built in HTTPS encrypted socket](../../security/https.md), or by 106 putting a secure web proxy in front of it. You can listen on port `2375` on all 107 network interfaces with `-H tcp://0.0.0.0:2375`, or on a particular network 108 interface using its IP address: `-H tcp://192.168.59.103:2375`. It is 109 conventional to use port `2375` for un-encrypted, and port `2376` for encrypted 110 communication with the daemon. 111 112 > **Note:** 113 > If you're using an HTTPS encrypted socket, keep in mind that only 114 > TLS1.0 and greater are supported. Protocols SSLv3 and under are not 115 > supported anymore for security reasons. 116 117 On Systemd based systems, you can communicate with the daemon via 118 [Systemd socket activation](http://0pointer.de/blog/projects/socket-activation.html), 119 use `dockerd -H fd://`. Using `fd://` will work perfectly for most setups but 120 you can also specify individual sockets: `dockerd -H fd://3`. If the 121 specified socket activated files aren't found, then Docker will exit. You can 122 find examples of using Systemd socket activation with Docker and Systemd in the 123 [Docker source tree](https://github.com/docker/docker/tree/master/contrib/init/systemd/). 124 125 You can configure the Docker daemon to listen to multiple sockets at the same 126 time using multiple `-H` options: 127 128 ```bash 129 # listen using the default unix socket, and on 2 specific IP addresses on this host. 130 $ sudo dockerd -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2 131 ``` 132 133 The Docker client will honor the `DOCKER_HOST` environment variable to set the 134 `-H` flag for the client. 135 136 ```bash 137 $ docker -H tcp://0.0.0.0:2375 ps 138 # or 139 $ export DOCKER_HOST="tcp://0.0.0.0:2375" 140 $ docker ps 141 # both are equal 142 ``` 143 144 Setting the `DOCKER_TLS_VERIFY` environment variable to any value other than 145 the empty string is equivalent to setting the `--tlsverify` flag. The following 146 are equivalent: 147 148 ```bash 149 $ docker --tlsverify ps 150 # or 151 $ export DOCKER_TLS_VERIFY=1 152 $ docker ps 153 ``` 154 155 The Docker client will honor the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` 156 environment variables (or the lowercase versions thereof). `HTTPS_PROXY` takes 157 precedence over `HTTP_PROXY`. 158 159 ### Bind Docker to another host/port or a Unix socket 160 161 > **Warning**: 162 > Changing the default `docker` daemon binding to a 163 > TCP port or Unix *docker* user group will increase your security risks 164 > by allowing non-root users to gain *root* access on the host. Make sure 165 > you control access to `docker`. If you are binding 166 > to a TCP port, anyone with access to that port has full Docker access; 167 > so it is not advisable on an open network. 168 169 With `-H` it is possible to make the Docker daemon to listen on a 170 specific IP and port. By default, it will listen on 171 `unix:///var/run/docker.sock` to allow only local connections by the 172 *root* user. You *could* set it to `0.0.0.0:2375` or a specific host IP 173 to give access to everybody, but that is **not recommended** because 174 then it is trivial for someone to gain root access to the host where the 175 daemon is running. 176 177 Similarly, the Docker client can use `-H` to connect to a custom port. 178 The Docker client will default to connecting to `unix:///var/run/docker.sock` 179 on Linux, and `tcp://127.0.0.1:2376` on Windows. 180 181 `-H` accepts host and port assignment in the following format: 182 183 tcp://[host]:[port][path] or unix://path 184 185 For example: 186 187 - `tcp://` -> TCP connection to `127.0.0.1` on either port `2376` when TLS encryption 188 is on, or port `2375` when communication is in plain text. 189 - `tcp://host:2375` -> TCP connection on 190 host:2375 191 - `tcp://host:2375/path` -> TCP connection on 192 host:2375 and prepend path to all requests 193 - `unix://path/to/socket` -> Unix socket located 194 at `path/to/socket` 195 196 `-H`, when empty, will default to the same value as 197 when no `-H` was passed in. 198 199 `-H` also accepts short form for TCP bindings: `host:` or `host:port` or `:port` 200 201 Run Docker in daemon mode: 202 203 ```bash 204 $ sudo <path to>/dockerd -H 0.0.0.0:5555 & 205 ``` 206 207 Download an `ubuntu` image: 208 209 ```bash 210 $ docker -H :5555 pull ubuntu 211 ``` 212 213 You can use multiple `-H`, for example, if you want to listen on both 214 TCP and a Unix socket 215 216 ```bash 217 # Run docker in daemon mode 218 $ sudo <path to>/dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock & 219 # Download an ubuntu image, use default Unix socket 220 $ docker pull ubuntu 221 # OR use the TCP port 222 $ docker -H tcp://127.0.0.1:2375 pull ubuntu 223 ``` 224 225 ### Daemon storage-driver option 226 227 The Docker daemon has support for several different image layer storage 228 drivers: `aufs`, `devicemapper`, `btrfs`, `zfs`, `overlay` and `overlay2`. 229 230 The `aufs` driver is the oldest, but is based on a Linux kernel patch-set that 231 is unlikely to be merged into the main kernel. These are also known to cause 232 some serious kernel crashes. However, `aufs` allows containers to share 233 executable and shared library memory, so is a useful choice when running 234 thousands of containers with the same program or libraries. 235 236 The `devicemapper` driver uses thin provisioning and Copy on Write (CoW) 237 snapshots. For each devicemapper graph location – typically 238 `/var/lib/docker/devicemapper` – a thin pool is created based on two block 239 devices, one for data and one for metadata. By default, these block devices 240 are created automatically by using loopback mounts of automatically created 241 sparse files. Refer to [Storage driver options](#storage-driver-options) below 242 for a way how to customize this setup. 243 [~jpetazzo/Resizing Docker containers with the Device Mapper plugin](http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/) 244 article explains how to tune your existing setup without the use of options. 245 246 The `btrfs` driver is very fast for `docker build` - but like `devicemapper` 247 does not share executable memory between devices. Use 248 `dockerd -s btrfs -g /mnt/btrfs_partition`. 249 250 The `zfs` driver is probably not as fast as `btrfs` but has a longer track record 251 on stability. Thanks to `Single Copy ARC` shared blocks between clones will be 252 cached only once. Use `dockerd -s zfs`. To select a different zfs filesystem 253 set `zfs.fsname` option as described in [Storage driver options](#storage-driver-options). 254 255 The `overlay` is a very fast union filesystem. It is now merged in the main 256 Linux kernel as of [3.18.0](https://lkml.org/lkml/2014/10/26/137). `overlay` 257 also supports page cache sharing, this means multiple containers accessing 258 the same file can share a single page cache entry (or entries), it makes 259 `overlay` as efficient with memory as `aufs` driver. Call 260 `dockerd -s overlay` to use it. 261 262 > **Note:** 263 > As promising as `overlay` is, the feature is still quite young and should not 264 > be used in production. Most notably, using `overlay` can cause excessive 265 > inode consumption (especially as the number of images grows), as well as 266 > being incompatible with the use of RPMs. 267 268 The `overlay2` uses the same fast union filesystem but takes advantage of 269 [additional features](https://lkml.org/lkml/2015/2/11/106) added in Linux 270 kernel 4.0 to avoid excessive inode consumption. Call `dockerd -s overlay2` 271 to use it. 272 273 > **Note:** 274 > Both `overlay` and `overlay2` are currently unsupported on `btrfs` or any 275 > Copy on Write filesystem and should only be used over `ext4` partitions. 276 277 ### Storage driver options 278 279 Particular storage-driver can be configured with options specified with 280 `--storage-opt` flags. Options for `devicemapper` are prefixed with `dm`, 281 options for `zfs` start with `zfs` and options for `btrfs` start with `btrfs`. 282 283 #### Devicemapper options 284 285 * `dm.thinpooldev` 286 287 Specifies a custom block storage device to use for the thin pool. 288 289 If using a block device for device mapper storage, it is best to use `lvm` 290 to create and manage the thin-pool volume. This volume is then handed to Docker 291 to exclusively create snapshot volumes needed for images and containers. 292 293 Managing the thin-pool outside of Engine makes for the most feature-rich 294 method of having Docker utilize device mapper thin provisioning as the 295 backing storage for Docker containers. The highlights of the lvm-based 296 thin-pool management feature include: automatic or interactive thin-pool 297 resize support, dynamically changing thin-pool features, automatic thinp 298 metadata checking when lvm activates the thin-pool, etc. 299 300 As a fallback if no thin pool is provided, loopback files are 301 created. Loopback is very slow, but can be used without any 302 pre-configuration of storage. It is strongly recommended that you do 303 not use loopback in production. Ensure your Engine daemon has a 304 `--storage-opt dm.thinpooldev` argument provided. 305 306 Example use: 307 308 ```bash 309 $ sudo dockerd --storage-opt dm.thinpooldev=/dev/mapper/thin-pool 310 ``` 311 312 * `dm.basesize` 313 314 Specifies the size to use when creating the base device, which limits the 315 size of images and containers. The default value is 10G. Note, thin devices 316 are inherently "sparse", so a 10G device which is mostly empty doesn't use 317 10 GB of space on the pool. However, the filesystem will use more space for 318 the empty case the larger the device is. 319 320 The base device size can be increased at daemon restart which will allow 321 all future images and containers (based on those new images) to be of the 322 new base device size. 323 324 Example use: 325 326 ```bash 327 $ sudo dockerd --storage-opt dm.basesize=50G 328 ``` 329 330 331 This will increase the base device size to 50G. The Docker daemon will throw an 332 error if existing base device size is larger than 50G. A user can use 333 this option to expand the base device size however shrinking is not permitted. 334 335 This value affects the system-wide "base" empty filesystem 336 that may already be initialized and inherited by pulled images. Typically, 337 a change to this value requires additional steps to take effect: 338 339 ```bash 340 $ sudo service docker stop 341 $ sudo rm -rf /var/lib/docker 342 $ sudo service docker start 343 ``` 344 345 Example use: 346 347 ```bash 348 $ sudo dockerd --storage-opt dm.basesize=20G 349 ``` 350 351 * `dm.loopdatasize` 352 353 > **Note**: 354 > This option configures devicemapper loopback, which should not 355 > be used in production. 356 357 Specifies the size to use when creating the loopback file for the 358 "data" device which is used for the thin pool. The default size is 359 100G. The file is sparse, so it will not initially take up this 360 much space. 361 362 Example use: 363 364 ```bash 365 $ sudo dockerd --storage-opt dm.loopdatasize=200G 366 ``` 367 368 * `dm.loopmetadatasize` 369 370 > **Note**: 371 > This option configures devicemapper loopback, which should not 372 > be used in production. 373 374 Specifies the size to use when creating the loopback file for the 375 "metadata" device which is used for the thin pool. The default size 376 is 2G. The file is sparse, so it will not initially take up 377 this much space. 378 379 Example use: 380 381 ```bash 382 $ sudo dockerd --storage-opt dm.loopmetadatasize=4G 383 ``` 384 385 * `dm.fs` 386 387 Specifies the filesystem type to use for the base device. The supported 388 options are "ext4" and "xfs". The default is "xfs" 389 390 Example use: 391 392 ```bash 393 $ sudo dockerd --storage-opt dm.fs=ext4 394 ``` 395 396 * `dm.mkfsarg` 397 398 Specifies extra mkfs arguments to be used when creating the base device. 399 400 Example use: 401 402 ```bash 403 $ sudo dockerd --storage-opt "dm.mkfsarg=-O ^has_journal" 404 ``` 405 406 * `dm.mountopt` 407 408 Specifies extra mount options used when mounting the thin devices. 409 410 Example use: 411 412 ```bash 413 $ sudo dockerd --storage-opt dm.mountopt=nodiscard 414 ``` 415 416 * `dm.datadev` 417 418 (Deprecated, use `dm.thinpooldev`) 419 420 Specifies a custom blockdevice to use for data for the thin pool. 421 422 If using a block device for device mapper storage, ideally both datadev and 423 metadatadev should be specified to completely avoid using the loopback 424 device. 425 426 Example use: 427 428 ```bash 429 $ sudo dockerd \ 430 --storage-opt dm.datadev=/dev/sdb1 \ 431 --storage-opt dm.metadatadev=/dev/sdc1 432 ``` 433 434 * `dm.metadatadev` 435 436 (Deprecated, use `dm.thinpooldev`) 437 438 Specifies a custom blockdevice to use for metadata for the thin pool. 439 440 For best performance the metadata should be on a different spindle than the 441 data, or even better on an SSD. 442 443 If setting up a new metadata pool it is required to be valid. This can be 444 achieved by zeroing the first 4k to indicate empty metadata, like this: 445 446 ```bash 447 $ dd if=/dev/zero of=$metadata_dev bs=4096 count=1 448 ``` 449 450 Example use: 451 452 ```bash 453 $ sudo dockerd \ 454 --storage-opt dm.datadev=/dev/sdb1 \ 455 --storage-opt dm.metadatadev=/dev/sdc1 456 ``` 457 458 * `dm.blocksize` 459 460 Specifies a custom blocksize to use for the thin pool. The default 461 blocksize is 64K. 462 463 Example use: 464 465 ```bash 466 $ sudo dockerd --storage-opt dm.blocksize=512K 467 ``` 468 469 * `dm.blkdiscard` 470 471 Enables or disables the use of blkdiscard when removing devicemapper 472 devices. This is enabled by default (only) if using loopback devices and is 473 required to resparsify the loopback file on image/container removal. 474 475 Disabling this on loopback can lead to *much* faster container removal 476 times, but will make the space used in `/var/lib/docker` directory not be 477 returned to the system for other use when containers are removed. 478 479 Example use: 480 481 ```bash 482 $ sudo dockerd --storage-opt dm.blkdiscard=false 483 ``` 484 485 * `dm.override_udev_sync_check` 486 487 Overrides the `udev` synchronization checks between `devicemapper` and `udev`. 488 `udev` is the device manager for the Linux kernel. 489 490 To view the `udev` sync support of a Docker daemon that is using the 491 `devicemapper` driver, run: 492 493 ```bash 494 $ docker info 495 [...] 496 Udev Sync Supported: true 497 [...] 498 ``` 499 500 When `udev` sync support is `true`, then `devicemapper` and udev can 501 coordinate the activation and deactivation of devices for containers. 502 503 When `udev` sync support is `false`, a race condition occurs between 504 the`devicemapper` and `udev` during create and cleanup. The race condition 505 results in errors and failures. (For information on these failures, see 506 [docker#4036](https://github.com/docker/docker/issues/4036)) 507 508 To allow the `docker` daemon to start, regardless of `udev` sync not being 509 supported, set `dm.override_udev_sync_check` to true: 510 511 ```bash 512 $ sudo dockerd --storage-opt dm.override_udev_sync_check=true 513 ``` 514 515 When this value is `true`, the `devicemapper` continues and simply warns 516 you the errors are happening. 517 518 > **Note:** 519 > The ideal is to pursue a `docker` daemon and environment that does 520 > support synchronizing with `udev`. For further discussion on this 521 > topic, see [docker#4036](https://github.com/docker/docker/issues/4036). 522 > Otherwise, set this flag for migrating existing Docker daemons to 523 > a daemon with a supported environment. 524 525 * `dm.use_deferred_removal` 526 527 Enables use of deferred device removal if `libdm` and the kernel driver 528 support the mechanism. 529 530 Deferred device removal means that if device is busy when devices are 531 being removed/deactivated, then a deferred removal is scheduled on 532 device. And devices automatically go away when last user of the device 533 exits. 534 535 For example, when a container exits, its associated thin device is removed. 536 If that device has leaked into some other mount namespace and can't be 537 removed, the container exit still succeeds and this option causes the 538 system to schedule the device for deferred removal. It does not wait in a 539 loop trying to remove a busy device. 540 541 Example use: 542 543 ```bash 544 $ sudo dockerd --storage-opt dm.use_deferred_removal=true 545 ``` 546 547 * `dm.use_deferred_deletion` 548 549 Enables use of deferred device deletion for thin pool devices. By default, 550 thin pool device deletion is synchronous. Before a container is deleted, 551 the Docker daemon removes any associated devices. If the storage driver 552 can not remove a device, the container deletion fails and daemon returns. 553 554 Error deleting container: Error response from daemon: Cannot destroy container 555 556 To avoid this failure, enable both deferred device deletion and deferred 557 device removal on the daemon. 558 559 ```bash 560 $ sudo dockerd \ 561 --storage-opt dm.use_deferred_deletion=true \ 562 --storage-opt dm.use_deferred_removal=true 563 ``` 564 565 With these two options enabled, if a device is busy when the driver is 566 deleting a container, the driver marks the device as deleted. Later, when 567 the device isn't in use, the driver deletes it. 568 569 In general it should be safe to enable this option by default. It will help 570 when unintentional leaking of mount point happens across multiple mount 571 namespaces. 572 573 * `dm.min_free_space` 574 575 Specifies the min free space percent in a thin pool require for new device 576 creation to succeed. This check applies to both free data space as well 577 as free metadata space. Valid values are from 0% - 99%. Value 0% disables 578 free space checking logic. If user does not specify a value for this option, 579 the Engine uses a default value of 10%. 580 581 Whenever a new a thin pool device is created (during `docker pull` or during 582 container creation), the Engine checks if the minimum free space is 583 available. If sufficient space is unavailable, then device creation fails 584 and any relevant `docker` operation fails. 585 586 To recover from this error, you must create more free space in the thin pool 587 to recover from the error. You can create free space by deleting some images 588 and containers from the thin pool. You can also add more storage to the thin 589 pool. 590 591 To add more space to a LVM (logical volume management) thin pool, just add 592 more storage to the volume group container thin pool; this should automatically 593 resolve any errors. If your configuration uses loop devices, then stop the 594 Engine daemon, grow the size of loop files and restart the daemon to resolve 595 the issue. 596 597 Example use: 598 599 ```bash 600 $ sudo dockerd --storage-opt dm.min_free_space=10% 601 ``` 602 603 * `dm.xfs_nospace_max_retries` 604 605 Specifies the maximum number of retries XFS should attempt to complete 606 IO when ENOSPC (no space) error is returned by underlying storage device. 607 608 By default XFS retries infinitely for IO to finish and this can result 609 in unkillable process. To change this behavior one can set 610 xfs_nospace_max_retries to say 0 and XFS will not retry IO after getting 611 ENOSPC and will shutdown filesystem. 612 613 Example use: 614 615 ```bash 616 $ sudo dockerd --storage-opt dm.xfs_nospace_max_retries=0 617 ``` 618 619 #### ZFS options 620 621 * `zfs.fsname` 622 623 Set zfs filesystem under which docker will create its own datasets. 624 By default docker will pick up the zfs filesystem where docker graph 625 (`/var/lib/docker`) is located. 626 627 Example use: 628 629 ```bash 630 $ sudo dockerd -s zfs --storage-opt zfs.fsname=zroot/docker 631 ``` 632 633 #### Btrfs options 634 635 * `btrfs.min_space` 636 637 Specifies the mininum size to use when creating the subvolume which is used 638 for containers. If user uses disk quota for btrfs when creating or running 639 a container with **--storage-opt size** option, docker should ensure the 640 **size** cannot be smaller than **btrfs.min_space**. 641 642 Example use: 643 644 ```bash 645 $ sudo dockerd -s btrfs --storage-opt btrfs.min_space=10G 646 ``` 647 648 #### Overlay2 options 649 650 * `overlay2.override_kernel_check` 651 652 Overrides the Linux kernel version check allowing overlay2. Support for 653 specifying multiple lower directories needed by overlay2 was added to the 654 Linux kernel in 4.0.0. However some older kernel versions may be patched 655 to add multiple lower directory support for OverlayFS. This option should 656 only be used after verifying this support exists in the kernel. Applying 657 this option on a kernel without this support will cause failures on mount. 658 659 ## Docker runtime execution options 660 661 The Docker daemon relies on a 662 [OCI](https://github.com/opencontainers/runtime-spec) compliant runtime 663 (invoked via the `containerd` daemon) as its interface to the Linux 664 kernel `namespaces`, `cgroups`, and `SELinux`. 665 666 By default, the Docker daemon automatically starts `containerd`. If you want to 667 control `containerd` startup, manually start `containerd` and pass the path to 668 the `containerd` socket using the `--containerd` flag. For example: 669 670 ```bash 671 $ sudo dockerd --containerd /var/run/dev/docker-containerd.sock 672 ``` 673 674 Runtimes can be registered with the daemon either via the 675 configuration file or using the `--add-runtime` command line argument. 676 677 The following is an example adding 2 runtimes via the configuration: 678 ```json 679 "default-runtime": "runc", 680 "runtimes": { 681 "runc": { 682 "path": "runc" 683 }, 684 "custom": { 685 "path": "/usr/local/bin/my-runc-replacement", 686 "runtimeArgs": [ 687 "--debug" 688 ] 689 } 690 } 691 ``` 692 693 This is the same example via the command line: 694 695 ```bash 696 $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-runc-replacement 697 ``` 698 699 > **Note**: defining runtime arguments via the command line is not supported. 700 701 ## Options for the runtime 702 703 You can configure the runtime using options specified 704 with the `--exec-opt` flag. All the flag's options have the `native` prefix. A 705 single `native.cgroupdriver` option is available. 706 707 The `native.cgroupdriver` option specifies the management of the container's 708 cgroups. You can specify only specify `cgroupfs` or `systemd`. If you specify 709 `systemd` and it is not available, the system errors out. If you omit the 710 `native.cgroupdriver` option,` cgroupfs` is used. 711 712 This example sets the `cgroupdriver` to `systemd`: 713 714 ```bash 715 $ sudo dockerd --exec-opt native.cgroupdriver=systemd 716 ``` 717 718 Setting this option applies to all containers the daemon launches. 719 720 Also Windows Container makes use of `--exec-opt` for special purpose. Docker user 721 can specify default container isolation technology with this, for example: 722 723 ```bash 724 $ sudo dockerd --exec-opt isolation=hyperv 725 ``` 726 727 Will make `hyperv` the default isolation technology on Windows. If no isolation 728 value is specified on daemon start, on Windows client, the default is 729 `hyperv`, and on Windows server, the default is `process`. 730 731 ## Daemon DNS options 732 733 To set the DNS server for all Docker containers, use: 734 735 ```bash 736 $ sudo dockerd --dns 8.8.8.8 737 ``` 738 739 740 To set the DNS search domain for all Docker containers, use: 741 742 ```bash 743 $ sudo dockerd --dns-search example.com 744 ``` 745 746 747 ## Insecure registries 748 749 Docker considers a private registry either secure or insecure. In the rest of 750 this section, *registry* is used for *private registry*, and `myregistry:5000` 751 is a placeholder example for a private registry. 752 753 A secure registry uses TLS and a copy of its CA certificate is placed on the 754 Docker host at `/etc/docker/certs.d/myregistry:5000/ca.crt`. An insecure 755 registry is either not using TLS (i.e., listening on plain text HTTP), or is 756 using TLS with a CA certificate not known by the Docker daemon. The latter can 757 happen when the certificate was not found under 758 `/etc/docker/certs.d/myregistry:5000/`, or if the certificate verification 759 failed (i.e., wrong CA). 760 761 By default, Docker assumes all, but local (see local registries below), 762 registries are secure. Communicating with an insecure registry is not possible 763 if Docker assumes that registry is secure. In order to communicate with an 764 insecure registry, the Docker daemon requires `--insecure-registry` in one of 765 the following two forms: 766 767 * `--insecure-registry myregistry:5000` tells the Docker daemon that 768 myregistry:5000 should be considered insecure. 769 * `--insecure-registry 10.1.0.0/16` tells the Docker daemon that all registries 770 whose domain resolve to an IP address is part of the subnet described by the 771 CIDR syntax, should be considered insecure. 772 773 The flag can be used multiple times to allow multiple registries to be marked 774 as insecure. 775 776 If an insecure registry is not marked as insecure, `docker pull`, 777 `docker push`, and `docker search` will result in an error message prompting 778 the user to either secure or pass the `--insecure-registry` flag to the Docker 779 daemon as described above. 780 781 Local registries, whose IP address falls in the 127.0.0.0/8 range, are 782 automatically marked as insecure as of Docker 1.3.2. It is not recommended to 783 rely on this, as it may change in the future. 784 785 Enabling `--insecure-registry`, i.e., allowing un-encrypted and/or untrusted 786 communication, can be useful when running a local registry. However, 787 because its use creates security vulnerabilities it should ONLY be enabled for 788 testing purposes. For increased security, users should add their CA to their 789 system's list of trusted CAs instead of enabling `--insecure-registry`. 790 791 ## Legacy Registries 792 793 Enabling `--disable-legacy-registry` forces a docker daemon to only interact with registries which support the V2 protocol. Specifically, the daemon will not attempt `push`, `pull` and `login` to v1 registries. The exception to this is `search` which can still be performed on v1 registries. 794 795 ## Running a Docker daemon behind an HTTPS_PROXY 796 797 When running inside a LAN that uses an `HTTPS` proxy, the Docker Hub 798 certificates will be replaced by the proxy's certificates. These certificates 799 need to be added to your Docker host's configuration: 800 801 1. Install the `ca-certificates` package for your distribution 802 2. Ask your network admin for the proxy's CA certificate and append them to 803 `/etc/pki/tls/certs/ca-bundle.crt` 804 3. Then start your Docker daemon with `HTTPS_PROXY=http://username:password@proxy:port/ dockerd`. 805 The `username:` and `password@` are optional - and are only needed if your 806 proxy is set up to require authentication. 807 808 This will only add the proxy and authentication to the Docker daemon's requests - 809 your `docker build`s and running containers will need extra configuration to 810 use the proxy 811 812 ## Default Ulimits 813 814 `--default-ulimit` allows you to set the default `ulimit` options to use for 815 all containers. It takes the same options as `--ulimit` for `docker run`. If 816 these defaults are not set, `ulimit` settings will be inherited, if not set on 817 `docker run`, from the Docker daemon. Any `--ulimit` options passed to 818 `docker run` will overwrite these defaults. 819 820 Be careful setting `nproc` with the `ulimit` flag as `nproc` is designed by Linux to 821 set the maximum number of processes available to a user, not to a container. For details 822 please check the [run](run.md) reference. 823 824 ## Nodes discovery 825 826 The `--cluster-advertise` option specifies the `host:port` or `interface:port` 827 combination that this particular daemon instance should use when advertising 828 itself to the cluster. The daemon is reached by remote hosts through this value. 829 If you specify an interface, make sure it includes the IP address of the actual 830 Docker host. For Engine installation created through `docker-machine`, the 831 interface is typically `eth1`. 832 833 The daemon uses [libkv](https://github.com/docker/libkv/) to advertise 834 the node within the cluster. Some key-value backends support mutual 835 TLS. To configure the client TLS settings used by the daemon can be configured 836 using the `--cluster-store-opt` flag, specifying the paths to PEM encoded 837 files. For example: 838 839 ```bash 840 $ sudo dockerd \ 841 --cluster-advertise 192.168.1.2:2376 \ 842 --cluster-store etcd://192.168.1.2:2379 \ 843 --cluster-store-opt kv.cacertfile=/path/to/ca.pem \ 844 --cluster-store-opt kv.certfile=/path/to/cert.pem \ 845 --cluster-store-opt kv.keyfile=/path/to/key.pem 846 ``` 847 848 The currently supported cluster store options are: 849 850 * `discovery.heartbeat` 851 852 Specifies the heartbeat timer in seconds which is used by the daemon as a 853 keepalive mechanism to make sure discovery module treats the node as alive 854 in the cluster. If not configured, the default value is 20 seconds. 855 856 * `discovery.ttl` 857 858 Specifies the ttl (time-to-live) in seconds which is used by the discovery 859 module to timeout a node if a valid heartbeat is not received within the 860 configured ttl value. If not configured, the default value is 60 seconds. 861 862 * `kv.cacertfile` 863 864 Specifies the path to a local file with PEM encoded CA certificates to trust 865 866 * `kv.certfile` 867 868 Specifies the path to a local file with a PEM encoded certificate. This 869 certificate is used as the client cert for communication with the 870 Key/Value store. 871 872 * `kv.keyfile` 873 874 Specifies the path to a local file with a PEM encoded private key. This 875 private key is used as the client key for communication with the 876 Key/Value store. 877 878 * `kv.path` 879 880 Specifies the path in the Key/Value store. If not configured, the default value is 'docker/nodes'. 881 882 ## Access authorization 883 884 Docker's access authorization can be extended by authorization plugins that your 885 organization can purchase or build themselves. You can install one or more 886 authorization plugins when you start the Docker `daemon` using the 887 `--authorization-plugin=PLUGIN_ID` option. 888 889 ```bash 890 $ sudo dockerd --authorization-plugin=plugin1 --authorization-plugin=plugin2,... 891 ``` 892 893 The `PLUGIN_ID` value is either the plugin's name or a path to its specification 894 file. The plugin's implementation determines whether you can specify a name or 895 path. Consult with your Docker administrator to get information about the 896 plugins available to you. 897 898 Once a plugin is installed, requests made to the `daemon` through the command 899 line or Docker's remote API are allowed or denied by the plugin. If you have 900 multiple plugins installed, at least one must allow the request for it to 901 complete. 902 903 For information about how to create an authorization plugin, see [authorization 904 plugin](../../extend/plugins_authorization.md) section in the Docker extend section of this documentation. 905 906 907 ## Daemon user namespace options 908 909 The Linux kernel [user namespace support](http://man7.org/linux/man-pages/man7/user_namespaces.7.html) provides additional security by enabling 910 a process, and therefore a container, to have a unique range of user and 911 group IDs which are outside the traditional user and group range utilized by 912 the host system. Potentially the most important security improvement is that, 913 by default, container processes running as the `root` user will have expected 914 administrative privilege (with some restrictions) inside the container but will 915 effectively be mapped to an unprivileged `uid` on the host. 916 917 When user namespace support is enabled, Docker creates a single daemon-wide mapping 918 for all containers running on the same engine instance. The mappings will 919 utilize the existing subordinate user and group ID feature available on all modern 920 Linux distributions. 921 The [`/etc/subuid`](http://man7.org/linux/man-pages/man5/subuid.5.html) and 922 [`/etc/subgid`](http://man7.org/linux/man-pages/man5/subgid.5.html) files will be 923 read for the user, and optional group, specified to the `--userns-remap` 924 parameter. If you do not wish to specify your own user and/or group, you can 925 provide `default` as the value to this flag, and a user will be created on your behalf 926 and provided subordinate uid and gid ranges. This default user will be named 927 `dockremap`, and entries will be created for it in `/etc/passwd` and 928 `/etc/group` using your distro's standard user and group creation tools. 929 930 > **Note**: The single mapping per-daemon restriction is in place for now 931 > because Docker shares image layers from its local cache across all 932 > containers running on the engine instance. Since file ownership must be 933 > the same for all containers sharing the same layer content, the decision 934 > was made to map the file ownership on `docker pull` to the daemon's user and 935 > group mappings so that there is no delay for running containers once the 936 > content is downloaded. This design preserves the same performance for `docker 937 > pull`, `docker push`, and container startup as users expect with 938 > user namespaces disabled. 939 940 ### Starting the daemon with user namespaces enabled 941 942 To enable user namespace support, start the daemon with the 943 `--userns-remap` flag, which accepts values in the following formats: 944 945 - uid 946 - uid:gid 947 - username 948 - username:groupname 949 950 If numeric IDs are provided, translation back to valid user or group names 951 will occur so that the subordinate uid and gid information can be read, given 952 these resources are name-based, not id-based. If the numeric ID information 953 provided does not exist as entries in `/etc/passwd` or `/etc/group`, daemon 954 startup will fail with an error message. 955 956 > **Note:** On Fedora 22, you have to `touch` the `/etc/subuid` and `/etc/subgid` 957 > files to have ranges assigned when users are created. This must be done 958 > *before* the `--userns-remap` option is enabled. Once these files exist, the 959 > daemon can be (re)started and range assignment on user creation works properly. 960 961 **Example: starting with default Docker user management:** 962 963 ```bash 964 $ sudo dockerd --userns-remap=default 965 ``` 966 967 When `default` is provided, Docker will create - or find the existing - user and group 968 named `dockremap`. If the user is created, and the Linux distribution has 969 appropriate support, the `/etc/subuid` and `/etc/subgid` files will be populated 970 with a contiguous 65536 length range of subordinate user and group IDs, starting 971 at an offset based on prior entries in those files. For example, Ubuntu will 972 create the following range, based on an existing user named `user1` already owning 973 the first 65536 range: 974 975 ```bash 976 $ cat /etc/subuid 977 user1:100000:65536 978 dockremap:165536:65536 979 ``` 980 981 If you have a preferred/self-managed user with subordinate ID mappings already 982 configured, you can provide that username or uid to the `--userns-remap` flag. 983 If you have a group that doesn't match the username, you may provide the `gid` 984 or group name as well; otherwise the username will be used as the group name 985 when querying the system for the subordinate group ID range. 986 987 ### Detailed information on `subuid`/`subgid` ranges 988 989 Given potential advanced use of the subordinate ID ranges by power users, the 990 following paragraphs define how the Docker daemon currently uses the range entries 991 found within the subordinate range files. 992 993 The simplest case is that only one contiguous range is defined for the 994 provided user or group. In this case, Docker will use that entire contiguous 995 range for the mapping of host uids and gids to the container process. This 996 means that the first ID in the range will be the remapped root user, and the 997 IDs above that initial ID will map host ID 1 through the end of the range. 998 999 From the example `/etc/subuid` content shown above, the remapped root 1000 user would be uid 165536. 1001 1002 If the system administrator has set up multiple ranges for a single user or 1003 group, the Docker daemon will read all the available ranges and use the 1004 following algorithm to create the mapping ranges: 1005 1006 1. The range segments found for the particular user will be sorted by *start ID* ascending. 1007 2. Map segments will be created from each range in increasing value with a length matching the length of each segment. Therefore the range segment with the lowest numeric starting value will be equal to the remapped root, and continue up through host uid/gid equal to the range segment length. As an example, if the lowest segment starts at ID 1000 and has a length of 100, then a map of 1000 -> 0 (the remapped root) up through 1100 -> 100 will be created from this segment. If the next segment starts at ID 10000, then the next map will start with mapping 10000 -> 101 up to the length of this second segment. This will continue until no more segments are found in the subordinate files for this user. 1008 3. If more than five range segments exist for a single user, only the first five will be utilized, matching the kernel's limitation of only five entries in `/proc/self/uid_map` and `proc/self/gid_map`. 1009 1010 ### Disable user namespace for a container 1011 1012 If you enable user namespaces on the daemon, all containers are started 1013 with user namespaces enabled. In some situations you might want to disable 1014 this feature for a container, for example, to start a privileged container (see 1015 [user namespace known restrictions](#user-namespace-known-restrictions)). 1016 To enable those advanced features for a specific container use `--userns=host` 1017 in the `run/exec/create` command. 1018 This option will completely disable user namespace mapping for the container's user. 1019 1020 ### User namespace known restrictions 1021 1022 The following standard Docker features are currently incompatible when 1023 running a Docker daemon with user namespaces enabled: 1024 1025 - sharing PID or NET namespaces with the host (`--pid=host` or `--net=host`) 1026 - Using `--privileged` mode flag on `docker run` (unless also specifying `--userns=host`) 1027 1028 In general, user namespaces are an advanced feature and will require 1029 coordination with other capabilities. For example, if volumes are mounted from 1030 the host, file ownership will have to be pre-arranged if the user or 1031 administrator wishes the containers to have expected access to the volume 1032 contents. Note that when using external volume or graph driver plugins, those 1033 external software programs must be made aware of user and group mapping ranges 1034 if they are to work seamlessly with user namespace support. 1035 1036 Finally, while the `root` user inside a user namespaced container process has 1037 many of the expected admin privileges that go along with being the superuser, the 1038 Linux kernel has restrictions based on internal knowledge that this is a user namespaced 1039 process. The most notable restriction that we are aware of at this time is the 1040 inability to use `mknod`. Permission will be denied for device creation even as 1041 container `root` inside a user namespace. 1042 1043 ## Miscellaneous options 1044 1045 IP masquerading uses address translation to allow containers without a public 1046 IP to talk to other machines on the Internet. This may interfere with some 1047 network topologies and can be disabled with `--ip-masq=false`. 1048 1049 Docker supports softlinks for the Docker data directory (`/var/lib/docker`) and 1050 for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be 1051 set like this: 1052 1053 DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/dockerd -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 1054 # or 1055 export DOCKER_TMPDIR=/mnt/disk2/tmp 1056 /usr/local/bin/dockerd -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1 1057 1058 ## Default cgroup parent 1059 1060 The `--cgroup-parent` option allows you to set the default cgroup parent 1061 to use for containers. If this option is not set, it defaults to `/docker` for 1062 fs cgroup driver and `system.slice` for systemd cgroup driver. 1063 1064 If the cgroup has a leading forward slash (`/`), the cgroup is created 1065 under the root cgroup, otherwise the cgroup is created under the daemon 1066 cgroup. 1067 1068 Assuming the daemon is running in cgroup `daemoncgroup`, 1069 `--cgroup-parent=/foobar` creates a cgroup in 1070 `/sys/fs/cgroup/memory/foobar`, whereas using `--cgroup-parent=foobar` 1071 creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar` 1072 1073 The systemd cgroup driver has different rules for `--cgroup-parent`. Systemd 1074 represents hierarchy by slice and the name of the slice encodes the location in 1075 the tree. So `--cgroup-parent` for systemd cgroups should be a slice name. A 1076 name can consist of a dash-separated series of names, which describes the path 1077 to the slice from the root slice. For example, `--cgroup-parent=user-a-b.slice` 1078 means the memory cgroup for the container is created in 1079 `/sys/fs/cgroup/memory/user.slice/user-a.slice/user-a-b.slice/docker-<id>.scope`. 1080 1081 This setting can also be set per container, using the `--cgroup-parent` 1082 option on `docker create` and `docker run`, and takes precedence over 1083 the `--cgroup-parent` option on the daemon. 1084 1085 ## Daemon configuration file 1086 1087 The `--config-file` option allows you to set any configuration option 1088 for the daemon in a JSON format. This file uses the same flag names as keys, 1089 except for flags that allow several entries, where it uses the plural 1090 of the flag name, e.g., `labels` for the `label` flag. 1091 1092 The options set in the configuration file must not conflict with options set 1093 via flags. The docker daemon fails to start if an option is duplicated between 1094 the file and the flags, regardless their value. We do this to avoid 1095 silently ignore changes introduced in configuration reloads. 1096 For example, the daemon fails to start if you set daemon labels 1097 in the configuration file and also set daemon labels via the `--label` flag. 1098 Options that are not present in the file are ignored when the daemon starts. 1099 1100 ### Linux configuration file 1101 1102 The default location of the configuration file on Linux is 1103 `/etc/docker/daemon.json`. The `--config-file` flag can be used to specify a 1104 non-default location. 1105 1106 This is a full example of the allowed configuration options on Linux: 1107 1108 ```json 1109 { 1110 "authorization-plugins": [], 1111 "dns": [], 1112 "dns-opts": [], 1113 "dns-search": [], 1114 "exec-opts": [], 1115 "exec-root": "", 1116 "storage-driver": "", 1117 "storage-opts": [], 1118 "labels": [], 1119 "live-restore": true, 1120 "log-driver": "", 1121 "log-opts": {}, 1122 "mtu": 0, 1123 "pidfile": "", 1124 "graph": "", 1125 "cluster-store": "", 1126 "cluster-store-opts": {}, 1127 "cluster-advertise": "", 1128 "max-concurrent-downloads": 3, 1129 "max-concurrent-uploads": 5, 1130 "debug": true, 1131 "hosts": [], 1132 "log-level": "", 1133 "tls": true, 1134 "tlsverify": true, 1135 "tlscacert": "", 1136 "tlscert": "", 1137 "tlskey": "", 1138 "swarm-default-advertise-addr": "", 1139 "api-cors-header": "", 1140 "selinux-enabled": false, 1141 "userns-remap": "", 1142 "group": "", 1143 "cgroup-parent": "", 1144 "default-ulimits": {}, 1145 "init": false, 1146 "init-path": "/usr/libexec/docker-init", 1147 "ipv6": false, 1148 "iptables": false, 1149 "ip-forward": false, 1150 "ip-masq": false, 1151 "userland-proxy": false, 1152 "ip": "0.0.0.0", 1153 "bridge": "", 1154 "bip": "", 1155 "fixed-cidr": "", 1156 "fixed-cidr-v6": "", 1157 "default-gateway": "", 1158 "default-gateway-v6": "", 1159 "icc": false, 1160 "raw-logs": false, 1161 "registry-mirrors": [], 1162 "insecure-registries": [], 1163 "disable-legacy-registry": false, 1164 "default-runtime": "runc", 1165 "oom-score-adjust": -500, 1166 "runtimes": { 1167 "runc": { 1168 "path": "runc" 1169 }, 1170 "custom": { 1171 "path": "/usr/local/bin/my-runc-replacement", 1172 "runtimeArgs": [ 1173 "--debug" 1174 ] 1175 } 1176 } 1177 } 1178 ``` 1179 1180 ### Windows configuration file 1181 1182 The default location of the configuration file on Windows is 1183 `%programdata%\docker\config\daemon.json`. The `--config-file` flag can be 1184 used to specify a non-default location. 1185 1186 This is a full example of the allowed configuration options on Windows: 1187 1188 ```json 1189 { 1190 "authorization-plugins": [], 1191 "dns": [], 1192 "dns-opts": [], 1193 "dns-search": [], 1194 "exec-opts": [], 1195 "storage-driver": "", 1196 "storage-opts": [], 1197 "labels": [], 1198 "live-restore": true, 1199 "log-driver": "", 1200 "mtu": 0, 1201 "pidfile": "", 1202 "graph": "", 1203 "cluster-store": "", 1204 "cluster-advertise": "", 1205 "debug": true, 1206 "hosts": [], 1207 "log-level": "", 1208 "tlsverify": true, 1209 "tlscacert": "", 1210 "tlscert": "", 1211 "tlskey": "", 1212 "swarm-default-advertise-addr": "", 1213 "group": "", 1214 "default-ulimits": {}, 1215 "bridge": "", 1216 "fixed-cidr": "", 1217 "raw-logs": false, 1218 "registry-mirrors": [], 1219 "insecure-registries": [], 1220 "disable-legacy-registry": false 1221 } 1222 ``` 1223 1224 ### Configuration reloading 1225 1226 Some options can be reconfigured when the daemon is running without requiring 1227 to restart the process. We use the `SIGHUP` signal in Linux to reload, and a global event 1228 in Windows with the key `Global\docker-daemon-config-$PID`. The options can 1229 be modified in the configuration file but still will check for conflicts with 1230 the provided flags. The daemon fails to reconfigure itself 1231 if there are conflicts, but it won't stop execution. 1232 1233 The list of currently supported options that can be reconfigured is this: 1234 1235 - `debug`: it changes the daemon to debug mode when set to true. 1236 - `cluster-store`: it reloads the discovery store with the new address. 1237 - `cluster-store-opts`: it uses the new options to reload the discovery store. 1238 - `cluster-advertise`: it modifies the address advertised after reloading. 1239 - `labels`: it replaces the daemon labels with a new set of labels. 1240 - `live-restore`: Enables [keeping containers alive during daemon downtime](../../admin/live-restore.md). 1241 - `max-concurrent-downloads`: it updates the max concurrent downloads for each pull. 1242 - `max-concurrent-uploads`: it updates the max concurrent uploads for each push. 1243 - `default-runtime`: it updates the runtime to be used if not is 1244 specified at container creation. It defaults to "default" which is 1245 the runtime shipped with the official docker packages. 1246 - `runtimes`: it updates the list of available OCI runtimes that can 1247 be used to run containers 1248 - `authorization-plugin`: specifies the authorization plugins to use. 1249 1250 Updating and reloading the cluster configurations such as `--cluster-store`, 1251 `--cluster-advertise` and `--cluster-store-opts` will take effect only if 1252 these configurations were not previously configured. If `--cluster-store` 1253 has been provided in flags and `cluster-advertise` not, `cluster-advertise` 1254 can be added in the configuration file without accompanied by `--cluster-store` 1255 Configuration reload will log a warning message if it detects a change in 1256 previously configured cluster configurations. 1257 1258 1259 ## Running multiple daemons 1260 1261 > **Note:** Running multiple daemons on a single host is considered as "experimental". The user should be aware of 1262 > unsolved problems. This solution may not work properly in some cases. Solutions are currently under development 1263 > and will be delivered in the near future. 1264 1265 This section describes how to run multiple Docker daemons on a single host. To 1266 run multiple daemons, you must configure each daemon so that it does not 1267 conflict with other daemons on the same host. You can set these options either 1268 by providing them as flags, or by using a [daemon configuration file](#daemon-configuration-file). 1269 1270 The following daemon options must be configured for each daemon: 1271 1272 ```bash 1273 -b, --bridge= Attach containers to a network bridge 1274 --exec-root=/var/run/docker Root of the Docker execdriver 1275 -g, --graph=/var/lib/docker Root of the Docker runtime 1276 -p, --pidfile=/var/run/docker.pid Path to use for daemon PID file 1277 -H, --host=[] Daemon socket(s) to connect to 1278 --iptables=true Enable addition of iptables rules 1279 --config-file=/etc/docker/daemon.json Daemon configuration file 1280 --tlscacert="~/.docker/ca.pem" Trust certs signed only by this CA 1281 --tlscert="~/.docker/cert.pem" Path to TLS certificate file 1282 --tlskey="~/.docker/key.pem" Path to TLS key file 1283 ``` 1284 1285 When your daemons use different values for these flags, you can run them on the same host without any problems. 1286 It is very important to properly understand the meaning of those options and to use them correctly. 1287 1288 - The `-b, --bridge=` flag is set to `docker0` as default bridge network. It is created automatically when you install Docker. 1289 If you are not using the default, you must create and configure the bridge manually or just set it to 'none': `--bridge=none` 1290 - `--exec-root` is the path where the container state is stored. The default value is `/var/run/docker`. Specify the path for 1291 your running daemon here. 1292 - `--graph` is the path where images are stored. The default value is `/var/lib/docker`. To avoid any conflict with other daemons 1293 set this parameter separately for each daemon. 1294 - `-p, --pidfile=/var/run/docker.pid` is the path where the process ID of the daemon is stored. Specify the path for your 1295 pid file here. 1296 - `--host=[]` specifies where the Docker daemon will listen for client connections. If unspecified, it defaults to `/var/run/docker.sock`. 1297 - `--iptables=false` prevents the Docker daemon from adding iptables rules. If 1298 multiple daemons manage iptables rules, they may overwrite rules set by 1299 another daemon. Be aware that disabling this option requires you to manually 1300 add iptables rules to expose container ports. 1301 - `--config-file=/etc/docker/daemon.json` is the path where configuration file is stored. You can use it instead of 1302 daemon flags. Specify the path for each daemon. 1303 - `--tls*` Docker daemon supports `--tlsverify` mode that enforces encrypted and authenticated remote connections. 1304 The `--tls*` options enable use of specific certificates for individual daemons. 1305 1306 Example script for a separate “bootstrap” instance of the Docker daemon without network: 1307 1308 ```bash 1309 $ sudo dockerd \ 1310 -H unix:///var/run/docker-bootstrap.sock \ 1311 -p /var/run/docker-bootstrap.pid \ 1312 --iptables=false \ 1313 --ip-masq=false \ 1314 --bridge=none \ 1315 --graph=/var/lib/docker-bootstrap \ 1316 --exec-root=/var/run/docker-bootstrap 1317 ```