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