github.com/uppal0016/docker_new@v0.0.0-20240123060250-1c98be13ac2c/man/docker-daemon.8.md (about) 1 % DOCKER(8) Docker User Manuals 2 % Shishir Mahajan 3 % SEPTEMBER 2015 4 # NAME 5 docker-daemon - Enable daemon mode 6 7 # SYNOPSIS 8 **docker daemon** 9 [**--api-cors-header**=[=*API-CORS-HEADER*]] 10 [**--authorization-plugin**[=*[]*]] 11 [**-b**|**--bridge**[=*BRIDGE*]] 12 [**--bip**[=*BIP*]] 13 [**--cgroup-parent**[=*[]*]] 14 [**--cluster-store**[=*[]*]] 15 [**--cluster-advertise**[=*[]*]] 16 [**--cluster-store-opt**[=*map[]*]] 17 [**--config-file**[=*/etc/docker/daemon.json*]] 18 [**--containerd**[=*SOCKET-PATH*]] 19 [**-D**|**--debug**] 20 [**--default-gateway**[=*DEFAULT-GATEWAY*]] 21 [**--default-gateway-v6**[=*DEFAULT-GATEWAY-V6*]] 22 [**--default-ulimit**[=*[]*]] 23 [**--disable-legacy-registry**] 24 [**--dns**[=*[]*]] 25 [**--dns-opt**[=*[]*]] 26 [**--dns-search**[=*[]*]] 27 [**--exec-opt**[=*[]*]] 28 [**--exec-root**[=*/var/run/docker*]] 29 [**--fixed-cidr**[=*FIXED-CIDR*]] 30 [**--fixed-cidr-v6**[=*FIXED-CIDR-V6*]] 31 [**-G**|**--group**[=*docker*]] 32 [**-g**|**--graph**[=*/var/lib/docker*]] 33 [**-H**|**--host**[=*[]*]] 34 [**--help**] 35 [**--icc**[=*true*]] 36 [**--insecure-registry**[=*[]*]] 37 [**--ip**[=*0.0.0.0*]] 38 [**--ip-forward**[=*true*]] 39 [**--ip-masq**[=*true*]] 40 [**--iptables**[=*true*]] 41 [**--ipv6**] 42 [**-l**|**--log-level**[=*info*]] 43 [**--label**[=*[]*]] 44 [**--log-driver**[=*json-file*]] 45 [**--log-opt**[=*map[]*]] 46 [**--mtu**[=*0*]] 47 [**-p**|**--pidfile**[=*/var/run/docker.pid*]] 48 [**--raw-logs**] 49 [**--registry-mirror**[=*[]*]] 50 [**-s**|**--storage-driver**[=*STORAGE-DRIVER*]] 51 [**--selinux-enabled**] 52 [**--storage-opt**[=*[]*]] 53 [**--tls**] 54 [**--tlscacert**[=*~/.docker/ca.pem*]] 55 [**--tlscert**[=*~/.docker/cert.pem*]] 56 [**--tlskey**[=*~/.docker/key.pem*]] 57 [**--tlsverify**] 58 [**--userland-proxy**[=*true*]] 59 [**--userns-remap**[=*default*]] 60 61 # DESCRIPTION 62 **docker** has two distinct functions. It is used for starting the Docker 63 daemon and to run the CLI (i.e., to command the daemon to manage images, 64 containers etc.) So **docker** is both a server, as a daemon, and a client 65 to the daemon, through the CLI. 66 67 To run the Docker daemon you can specify **docker daemon**. 68 You can check the daemon options using **docker daemon --help**. 69 Daemon options should be specified after the **daemon** keyword in the following 70 format. 71 72 **docker daemon [OPTIONS]** 73 74 # OPTIONS 75 76 **--api-cors-header**="" 77 Set CORS headers in the remote API. Default is cors disabled. Give urls like "http://foo, http://bar, ...". Give "*" to allow all. 78 79 **--authorization-plugin**="" 80 Set authorization plugins to load 81 82 **-b**, **--bridge**="" 83 Attach containers to a pre\-existing network bridge; use 'none' to disable container networking 84 85 **--bip**="" 86 Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b 87 88 **--cgroup-parent**="" 89 Set parent cgroup for all containers. Default is "/docker" for fs cgroup driver and "system.slice" for systemd cgroup driver. 90 91 **--cluster-store**="" 92 URL of the distributed storage backend 93 94 **--cluster-advertise**="" 95 Specifies the 'host:port' or `interface:port` combination that this particular 96 daemon instance should use when advertising itself to the cluster. The daemon 97 is reached through this value. 98 99 **--cluster-store-opt**="" 100 Specifies options for the Key/Value store. 101 102 **--config-file**="/etc/docker/daemon.json" 103 Specifies the JSON file path to load the configuration from. 104 105 **--containerd**="" 106 Path to containerd socket. 107 108 **-D**, **--debug**=*true*|*false* 109 Enable debug mode. Default is false. 110 111 **--default-gateway**="" 112 IPv4 address of the container default gateway; this address must be part of the bridge subnet (which is defined by \-b or \--bip) 113 114 **--default-gateway-v6**="" 115 IPv6 address of the container default gateway 116 117 **--default-ulimit**=[] 118 Set default ulimits for containers. 119 120 **--disable-legacy-registry**=*true*|*false* 121 Do not contact legacy registries 122 123 **--dns**="" 124 Force Docker to use specific DNS servers 125 126 **--dns-opt**="" 127 DNS options to use. 128 129 **--dns-search**=[] 130 DNS search domains to use. 131 132 **--exec-opt**=[] 133 Set runtime execution options. See RUNTIME EXECUTION OPTIONS. 134 135 **--exec-root**="" 136 Path to use as the root of the Docker execution state files. Default is `/var/run/docker`. 137 138 **--fixed-cidr**="" 139 IPv4 subnet for fixed IPs (e.g., 10.20.0.0/16); this subnet must be nested in the bridge subnet (which is defined by \-b or \-\-bip) 140 141 **--fixed-cidr-v6**="" 142 IPv6 subnet for global IPv6 addresses (e.g., 2a00:1450::/64) 143 144 **-G**, **--group**="" 145 Group to assign the unix socket specified by -H when running in daemon mode. 146 use '' (the empty string) to disable setting of a group. Default is `docker`. 147 148 **-g**, **--graph**="" 149 Path to use as the root of the Docker runtime. Default is `/var/lib/docker`. 150 151 **-H**, **--host**=[*unix:///var/run/docker.sock*]: tcp://[host:port] to bind or 152 unix://[/path/to/socket] to use. 153 The socket(s) to bind to in daemon mode specified using one or more 154 tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd. 155 156 **--help** 157 Print usage statement 158 159 **--icc**=*true*|*false* 160 Allow unrestricted inter\-container and Docker daemon host communication. If disabled, containers can still be linked together using the **--link** option (see **docker-run(1)**). Default is true. 161 162 **--insecure-registry**=[] 163 Enable insecure registry communication, i.e., enable un-encrypted and/or untrusted communication. 164 165 List of insecure registries can contain an element with CIDR notation to specify a whole subnet. Insecure registries accept HTTP and/or accept HTTPS with certificates from unknown CAs. 166 167 Enabling `--insecure-registry` is useful when running a local registry. However, because its use creates security vulnerabilities it should ONLY be enabled for testing purposes. For increased security, users should add their CA to their system's list of trusted CAs instead of using `--insecure-registry`. 168 169 **--ip**="" 170 Default IP address to use when binding container ports. Default is `0.0.0.0`. 171 172 **--ip-forward**=*true*|*false* 173 Enables IP forwarding on the Docker host. The default is `true`. This flag interacts with the IP forwarding setting on your host system's kernel. If your system has IP forwarding disabled, this setting enables it. If your system has IP forwarding enabled, setting this flag to `--ip-forward=false` has no effect. 174 175 This setting will also enable IPv6 forwarding if you have both `--ip-forward=true` and `--fixed-cidr-v6` set. Note that this may reject Router Advertisements and interfere with the host's existing IPv6 configuration. For more information, please consult the documentation about "Advanced Networking - IPv6". 176 177 **--ip-masq**=*true*|*false* 178 Enable IP masquerading for bridge's IP range. Default is true. 179 180 **--iptables**=*true*|*false* 181 Enable Docker's addition of iptables rules. Default is true. 182 183 **--ipv6**=*true*|*false* 184 Enable IPv6 support. Default is false. Docker will create an IPv6-enabled bridge with address fe80::1 which will allow you to create IPv6-enabled containers. Use together with `--fixed-cidr-v6` to provide globally routable IPv6 addresses. IPv6 forwarding will be enabled if not used with `--ip-forward=false`. This may collide with your host's current IPv6 settings. For more information please consult the documentation about "Advanced Networking - IPv6". 185 186 **-l**, **--log-level**="*debug*|*info*|*warn*|*error*|*fatal*" 187 Set the logging level. Default is `info`. 188 189 **--label**="[]" 190 Set key=value labels to the daemon (displayed in `docker info`) 191 192 **--log-driver**="*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*awslogs*|*splunk*|*etwlogs*|*gcplogs*|*none*" 193 Default driver for container logs. Default is `json-file`. 194 **Warning**: `docker logs` command works only for `json-file` logging driver. 195 196 **--log-opt**=[] 197 Logging driver specific options. 198 199 **--mtu**=*0* 200 Set the containers network mtu. Default is `0`. 201 202 **-p**, **--pidfile**="" 203 Path to use for daemon PID file. Default is `/var/run/docker.pid` 204 205 **--raw-logs** 206 Output daemon logs in full timestamp format without ANSI coloring. If this flag is not set, 207 the daemon outputs condensed, colorized logs if a terminal is detected, or full ("raw") 208 output otherwise. 209 210 **--registry-mirror**=*<scheme>://<host>* 211 Prepend a registry mirror to be used for image pulls. May be specified multiple times. 212 213 **-s**, **--storage-driver**="" 214 Force the Docker runtime to use a specific storage driver. 215 216 **--selinux-enabled**=*true*|*false* 217 Enable selinux support. Default is false. SELinux does not presently support the overlay storage driver. 218 219 **--storage-opt**=[] 220 Set storage driver options. See STORAGE DRIVER OPTIONS. 221 222 **--tls**=*true*|*false* 223 Use TLS; implied by --tlsverify. Default is false. 224 225 **--tlscacert**=*~/.docker/ca.pem* 226 Trust certs signed only by this CA. 227 228 **--tlscert**=*~/.docker/cert.pem* 229 Path to TLS certificate file. 230 231 **--tlskey**=*~/.docker/key.pem* 232 Path to TLS key file. 233 234 **--tlsverify**=*true*|*false* 235 Use TLS and verify the remote (daemon: verify client, client: verify daemon). 236 Default is false. 237 238 **--userland-proxy**=*true*|*false* 239 Rely on a userland proxy implementation for inter-container and outside-to-container loopback communications. Default is true. 240 241 **--userns-remap**=*default*|*uid:gid*|*user:group*|*user*|*uid* 242 Enable user namespaces for containers on the daemon. Specifying "default" will cause a new user and group to be created to handle UID and GID range remapping for the user namespace mappings used for contained processes. Specifying a user (or uid) and optionally a group (or gid) will cause the daemon to lookup the user and group's subordinate ID ranges for use as the user namespace mappings for contained processes. 243 244 # STORAGE DRIVER OPTIONS 245 246 Docker uses storage backends (known as "graphdrivers" in the Docker 247 internals) to create writable containers from images. Many of these 248 backends use operating system level technologies and can be 249 configured. 250 251 Specify options to the storage backend with **--storage-opt** flags. The 252 backends that currently take options are *devicemapper* and *zfs*. 253 Options for *devicemapper* are prefixed with *dm* and options for *zfs* 254 start with *zfs*. 255 256 Specifically for devicemapper, the default is a "loopback" model which 257 requires no pre-configuration, but is extremely inefficient. Do not 258 use it in production. 259 260 To make the best use of Docker with the devicemapper backend, you must 261 have a recent version of LVM. Use `lvm` to create a thin pool; for 262 more information see `man lvmthin`. Then, use `--storage-opt 263 dm.thinpooldev` to tell the Docker engine to use that pool for 264 allocating images and container snapshots. 265 266 ## Devicemapper options 267 268 #### dm.thinpooldev 269 270 Specifies a custom block storage device to use for the thin pool. 271 272 If using a block device for device mapper storage, it is best to use `lvm` 273 to create and manage the thin-pool volume. This volume is then handed to Docker 274 to exclusively create snapshot volumes needed for images and containers. 275 276 Managing the thin-pool outside of Engine makes for the most feature-rich 277 method of having Docker utilize device mapper thin provisioning as the 278 backing storage for Docker containers. The highlights of the lvm-based 279 thin-pool management feature include: automatic or interactive thin-pool 280 resize support, dynamically changing thin-pool features, automatic thinp 281 metadata checking when lvm activates the thin-pool, etc. 282 283 As a fallback if no thin pool is provided, loopback files are 284 created. Loopback is very slow, but can be used without any 285 pre-configuration of storage. It is strongly recommended that you do 286 not use loopback in production. Ensure your Engine daemon has a 287 `--storage-opt dm.thinpooldev` argument provided. 288 289 Example use: 290 291 $ docker daemon \ 292 --storage-opt dm.thinpooldev=/dev/mapper/thin-pool 293 294 #### dm.basesize 295 296 Specifies the size to use when creating the base device, which limits 297 the size of images and containers. The default value is 10G. Note, 298 thin devices are inherently "sparse", so a 10G device which is mostly 299 empty doesn't use 10 GB of space on the pool. However, the filesystem 300 will use more space for base images the larger the device 301 is. 302 303 The base device size can be increased at daemon restart which will allow 304 all future images and containers (based on those new images) to be of the 305 new base device size. 306 307 Example use: `docker daemon --storage-opt dm.basesize=50G` 308 309 This will increase the base device size to 50G. The Docker daemon will throw an 310 error if existing base device size is larger than 50G. A user can use 311 this option to expand the base device size however shrinking is not permitted. 312 313 This value affects the system-wide "base" empty filesystem that may already 314 be initialized and inherited by pulled images. Typically, a change to this 315 value requires additional steps to take effect: 316 317 $ sudo service docker stop 318 $ sudo rm -rf /var/lib/docker 319 $ sudo service docker start 320 321 Example use: `docker daemon --storage-opt dm.basesize=20G` 322 323 #### dm.fs 324 325 Specifies the filesystem type to use for the base device. The 326 supported options are `ext4` and `xfs`. The default is `ext4`. 327 328 Example use: `docker daemon --storage-opt dm.fs=xfs` 329 330 #### dm.mkfsarg 331 332 Specifies extra mkfs arguments to be used when creating the base device. 333 334 Example use: `docker daemon --storage-opt "dm.mkfsarg=-O ^has_journal"` 335 336 #### dm.mountopt 337 338 Specifies extra mount options used when mounting the thin devices. 339 340 Example use: `docker daemon --storage-opt dm.mountopt=nodiscard` 341 342 #### dm.use_deferred_removal 343 344 Enables use of deferred device removal if `libdm` and the kernel driver 345 support the mechanism. 346 347 Deferred device removal means that if device is busy when devices are 348 being removed/deactivated, then a deferred removal is scheduled on 349 device. And devices automatically go away when last user of the device 350 exits. 351 352 For example, when a container exits, its associated thin device is removed. If 353 that device has leaked into some other mount namespace and can't be removed, 354 the container exit still succeeds and this option causes the system to schedule 355 the device for deferred removal. It does not wait in a loop trying to remove a busy 356 device. 357 358 Example use: `docker daemon --storage-opt dm.use_deferred_removal=true` 359 360 #### dm.use_deferred_deletion 361 362 Enables use of deferred device deletion for thin pool devices. By default, 363 thin pool device deletion is synchronous. Before a container is deleted, the 364 Docker daemon removes any associated devices. If the storage driver can not 365 remove a device, the container deletion fails and daemon returns. 366 367 `Error deleting container: Error response from daemon: Cannot destroy container` 368 369 To avoid this failure, enable both deferred device deletion and deferred 370 device removal on the daemon. 371 372 `docker daemon --storage-opt dm.use_deferred_deletion=true --storage-opt dm.use_deferred_removal=true` 373 374 With these two options enabled, if a device is busy when the driver is 375 deleting a container, the driver marks the device as deleted. Later, when the 376 device isn't in use, the driver deletes it. 377 378 In general it should be safe to enable this option by default. It will help 379 when unintentional leaking of mount point happens across multiple mount 380 namespaces. 381 382 #### dm.loopdatasize 383 384 **Note**: This option configures devicemapper loopback, which should not be used in production. 385 386 Specifies the size to use when creating the loopback file for the 387 "data" device which is used for the thin pool. The default size is 388 100G. The file is sparse, so it will not initially take up 389 this much space. 390 391 Example use: `docker daemon --storage-opt dm.loopdatasize=200G` 392 393 #### dm.loopmetadatasize 394 395 **Note**: This option configures devicemapper loopback, which should not be used in production. 396 397 Specifies the size to use when creating the loopback file for the 398 "metadata" device which is used for the thin pool. The default size 399 is 2G. The file is sparse, so it will not initially take up 400 this much space. 401 402 Example use: `docker daemon --storage-opt dm.loopmetadatasize=4G` 403 404 #### dm.datadev 405 406 (Deprecated, use `dm.thinpooldev`) 407 408 Specifies a custom blockdevice to use for data for a 409 Docker-managed thin pool. It is better to use `dm.thinpooldev` - see 410 the documentation for it above for discussion of the advantages. 411 412 #### dm.metadatadev 413 414 (Deprecated, use `dm.thinpooldev`) 415 416 Specifies a custom blockdevice to use for metadata for a 417 Docker-managed thin pool. See `dm.datadev` for why this is 418 deprecated. 419 420 #### dm.blocksize 421 422 Specifies a custom blocksize to use for the thin pool. The default 423 blocksize is 64K. 424 425 Example use: `docker daemon --storage-opt dm.blocksize=512K` 426 427 #### dm.blkdiscard 428 429 Enables or disables the use of `blkdiscard` when removing devicemapper 430 devices. This is disabled by default due to the additional latency, 431 but as a special case with loopback devices it will be enabled, in 432 order to re-sparsify the loopback file on image/container removal. 433 434 Disabling this on loopback can lead to *much* faster container removal 435 times, but it also prevents the space used in `/var/lib/docker` directory 436 from being returned to the system for other use when containers are 437 removed. 438 439 Example use: `docker daemon --storage-opt dm.blkdiscard=false` 440 441 #### dm.override_udev_sync_check 442 443 By default, the devicemapper backend attempts to synchronize with the 444 `udev` device manager for the Linux kernel. This option allows 445 disabling that synchronization, to continue even though the 446 configuration may be buggy. 447 448 To view the `udev` sync support of a Docker daemon that is using the 449 `devicemapper` driver, run: 450 451 $ docker info 452 [...] 453 Udev Sync Supported: true 454 [...] 455 456 When `udev` sync support is `true`, then `devicemapper` and `udev` can 457 coordinate the activation and deactivation of devices for containers. 458 459 When `udev` sync support is `false`, a race condition occurs between 460 the `devicemapper` and `udev` during create and cleanup. The race 461 condition results in errors and failures. (For information on these 462 failures, see 463 [docker#4036](https://github.com/docker/docker/issues/4036)) 464 465 To allow the `docker` daemon to start, regardless of whether `udev` sync is 466 `false`, set `dm.override_udev_sync_check` to true: 467 468 $ docker daemon --storage-opt dm.override_udev_sync_check=true 469 470 When this value is `true`, the driver continues and simply warns you 471 the errors are happening. 472 473 **Note**: The ideal is to pursue a `docker` daemon and environment 474 that does support synchronizing with `udev`. For further discussion on 475 this topic, see 476 [docker#4036](https://github.com/docker/docker/issues/4036). 477 Otherwise, set this flag for migrating existing Docker daemons to a 478 daemon with a supported environment. 479 480 #### dm.min_free_space 481 482 Specifies the min free space percent in a thin pool require for new device 483 creation to succeed. This check applies to both free data space as well 484 as free metadata space. Valid values are from 0% - 99%. Value 0% disables 485 free space checking logic. If user does not specify a value for this option, 486 the Engine uses a default value of 10%. 487 488 Whenever a new a thin pool device is created (during `docker pull` or during 489 container creation), the Engine checks if the minimum free space is 490 available. If the space is unavailable, then device creation fails and any 491 relevant `docker` operation fails. 492 493 To recover from this error, you must create more free space in the thin pool to 494 recover from the error. You can create free space by deleting some images 495 and containers from tge thin pool. You can also add 496 more storage to the thin pool. 497 498 To add more space to an LVM (logical volume management) thin pool, just add 499 more storage to the group container thin pool; this should automatically 500 resolve any errors. If your configuration uses loop devices, then stop the 501 Engine daemon, grow the size of loop files and restart the daemon to resolve 502 the issue. 503 504 Example use:: `docker daemon --storage-opt dm.min_free_space=10%` 505 506 ## ZFS options 507 508 #### zfs.fsname 509 510 Set zfs filesystem under which docker will create its own datasets. 511 By default docker will pick up the zfs filesystem where docker graph 512 (`/var/lib/docker`) is located. 513 514 Example use: `docker daemon -s zfs --storage-opt zfs.fsname=zroot/docker` 515 516 # CLUSTER STORE OPTIONS 517 518 The daemon uses libkv to advertise 519 the node within the cluster. Some Key/Value backends support mutual 520 TLS, and the client TLS settings used by the daemon can be configured 521 using the **--cluster-store-opt** flag, specifying the paths to PEM encoded 522 files. 523 524 #### kv.cacertfile 525 526 Specifies the path to a local file with PEM encoded CA certificates to trust 527 528 #### kv.certfile 529 530 Specifies the path to a local file with a PEM encoded certificate. This 531 certificate is used as the client cert for communication with the 532 Key/Value store. 533 534 #### kv.keyfile 535 536 Specifies the path to a local file with a PEM encoded private key. This 537 private key is used as the client key for communication with the 538 Key/Value store. 539 540 # Access authorization 541 542 Docker's access authorization can be extended by authorization plugins that your 543 organization can purchase or build themselves. You can install one or more 544 authorization plugins when you start the Docker `daemon` using the 545 `--authorization-plugin=PLUGIN_ID` option. 546 547 ```bash 548 docker daemon --authorization-plugin=plugin1 --authorization-plugin=plugin2,... 549 ``` 550 551 The `PLUGIN_ID` value is either the plugin's name or a path to its specification 552 file. The plugin's implementation determines whether you can specify a name or 553 path. Consult with your Docker administrator to get information about the 554 plugins available to you. 555 556 Once a plugin is installed, requests made to the `daemon` through the command 557 line or Docker's remote API are allowed or denied by the plugin. If you have 558 multiple plugins installed, at least one must allow the request for it to 559 complete. 560 561 For information about how to create an authorization plugin, see [authorization 562 plugin](https://docs.docker.com/engine/extend/authorization/) section in the 563 Docker extend section of this documentation. 564 565 566 # HISTORY 567 Sept 2015, Originally compiled by Shishir Mahajan <shishir.mahajan@redhat.com> 568 based on docker.com source material and internal work.