github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/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 -D` or add `"debug": true` to
   119  the `daemon.json` 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  `/data/docker/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](http://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  ```bash
   178  # listen using the default unix socket, and on 2 specific IP addresses on this host.
   179  
   180  $ sudo dockerd -H unix:///data/docker/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2
   181  ```
   182  
   183  The Docker client will honor the `DOCKER_HOST` environment variable to set the
   184  `-H` flag for the client. Use **one** of the following commands:
   185  
   186  ```bash
   187  $ docker -H tcp://0.0.0.0:2375 ps
   188  ```
   189  
   190  ```bash
   191  $ export DOCKER_HOST="tcp://0.0.0.0:2375"
   192  
   193  $ docker ps
   194  ```
   195  
   196  Setting the `DOCKER_TLS_VERIFY` environment variable to any value other than
   197  the empty string is equivalent to setting the `--tlsverify` flag. The following
   198  are equivalent:
   199  
   200  ```bash
   201  $ docker --tlsverify ps
   202  # or
   203  $ export DOCKER_TLS_VERIFY=1
   204  $ docker ps
   205  ```
   206  
   207  The Docker client will honor the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
   208  environment variables (or the lowercase versions thereof). `HTTPS_PROXY` takes
   209  precedence over `HTTP_PROXY`.
   210  
   211  The Docker client supports connecting to a remote daemon via SSH:
   212  
   213  ```
   214  $ docker -H ssh://me@example.com:22 ps
   215  $ docker -H ssh://me@example.com ps
   216  $ docker -H ssh://example.com ps
   217  ```
   218  
   219  To use SSH connection, you need to set up `ssh` so that it can reach the
   220  remote host with public key authentication. Password authentication is not
   221  supported. If your key is protected with passphrase, you need to set up
   222  `ssh-agent`.
   223  
   224  #### Bind Docker to another host/port or a Unix socket
   225  
   226  > **Warning**
   227  >
   228  > Changing the default `docker` daemon binding to a
   229  > TCP port or Unix *docker* user group will increase your security risks
   230  > by allowing non-root users to gain *root* access on the host. Make sure
   231  > you control access to `docker`. If you are binding
   232  > to a TCP port, anyone with access to that port has full Docker access;
   233  > so it is not advisable on an open network.
   234  {: .warning :}
   235  
   236  With `-H` it is possible to make the Docker daemon to listen on a
   237  specific IP and port. By default, it will listen on
   238  `unix:///data/docker/run/docker.sock` to allow only local connections by the
   239  *root* user. You *could* set it to `0.0.0.0:2375` or a specific host IP
   240  to give access to everybody, but that is **not recommended** because
   241  then it is trivial for someone to gain root access to the host where the
   242  daemon is running.
   243  
   244  Similarly, the Docker client can use `-H` to connect to a custom port.
   245  The Docker client will default to connecting to `unix:///data/docker/run/docker.sock`
   246  on Linux, and `tcp://127.0.0.1:2376` on Windows.
   247  
   248  `-H` accepts host and port assignment in the following format:
   249  
   250      tcp://[host]:[port][path] or unix://path
   251  
   252  For example:
   253  
   254  -   `tcp://` -> TCP connection to `127.0.0.1` on either port `2376` when TLS encryption
   255      is on, or port `2375` when communication is in plain text.
   256  -   `tcp://host:2375` -> TCP connection on
   257      host:2375
   258  -   `tcp://host:2375/path` -> TCP connection on
   259      host:2375 and prepend path to all requests
   260  -   `unix://path/to/socket` -> Unix socket located
   261      at `path/to/socket`
   262  
   263  `-H`, when empty, will default to the same value as
   264  when no `-H` was passed in.
   265  
   266  `-H` also accepts short form for TCP bindings: `host:` or `host:port` or `:port`
   267  
   268  Run Docker in daemon mode:
   269  
   270  ```bash
   271  $ sudo <path to>/dockerd -H 0.0.0.0:5555 &
   272  ```
   273  
   274  Download an `ubuntu` image:
   275  
   276  ```bash
   277  $ docker -H :5555 pull ubuntu
   278  ```
   279  
   280  You can use multiple `-H`, for example, if you want to listen on both
   281  TCP and a Unix socket
   282  
   283  ```bash
   284  # Run docker in daemon mode
   285  $ sudo <path to>/dockerd -H tcp://127.0.0.1:2375 -H unix:///data/docker/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](http://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 -s btrfs -g /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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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   ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   589  $ dd if=/dev/zero of=$metadata_dev bs=4096 count=1
   590  ```
   591  
   592  ###### Example
   593  
   594  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
   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  ```bash
  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  ```bash
  1034  $ sudo dockerd --dns 8.8.8.8
  1035  ```
  1036  
  1037  To set the DNS search domain for all Docker containers, use:
  1038  
  1039  ```bash
  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  ```bash
  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  ```bash
  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, see [authorization
  1207  plugin](../../extend/plugins_authorization.md) section in the Docker extend section of this documentation.
  1208  
  1209  
  1210  ### Daemon user namespace options
  1211  
  1212  The Linux kernel
  1213  [user namespace support](http://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      DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/dockerd -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1
  1236      # or
  1237      export DOCKER_TMPDIR=/mnt/disk2/tmp
  1238      /usr/local/bin/dockerd -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1
  1239  
  1240  #### Default cgroup parent
  1241  
  1242  The `--cgroup-parent` option allows you to set the default cgroup parent
  1243  to use for containers. If this option is not set, it defaults to `/docker` for
  1244  fs cgroup driver and `system.slice` for systemd cgroup driver.
  1245  
  1246  If the cgroup has a leading forward slash (`/`), the cgroup is created
  1247  under the root cgroup, otherwise the cgroup is created under the daemon
  1248  cgroup.
  1249  
  1250  Assuming the daemon is running in cgroup `daemoncgroup`,
  1251  `--cgroup-parent=/foobar` creates a cgroup in
  1252  `/sys/fs/cgroup/memory/foobar`, whereas using `--cgroup-parent=foobar`
  1253  creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar`
  1254  
  1255  The systemd cgroup driver has different rules for `--cgroup-parent`. Systemd
  1256  represents hierarchy by slice and the name of the slice encodes the location in
  1257  the tree. So `--cgroup-parent` for systemd cgroups should be a slice name. A
  1258  name can consist of a dash-separated series of names, which describes the path
  1259  to the slice from the root slice. For example, `--cgroup-parent=user-a-b.slice`
  1260  means the memory cgroup for the container is created in
  1261  `/sys/fs/cgroup/memory/user.slice/user-a.slice/user-a-b.slice/docker-<id>.scope`.
  1262  
  1263  This setting can also be set per container, using the `--cgroup-parent`
  1264  option on `docker create` and `docker run`, and takes precedence over
  1265  the `--cgroup-parent` option on the daemon.
  1266  
  1267  #### Daemon metrics
  1268  
  1269  The `--metrics-addr` option takes a tcp address to serve the metrics API.
  1270  This feature is still experimental, therefore, the daemon must be running in experimental
  1271  mode for this feature to work.
  1272  
  1273  To serve the metrics API on `localhost:9323` you would specify `--metrics-addr 127.0.0.1:9323`,
  1274  allowing you to make requests on the API at `127.0.0.1:9323/metrics` to receive metrics in the
  1275  [prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) format.
  1276  
  1277  Port `9323` is the [default port associated with Docker
  1278  metrics](https://github.com/prometheus/prometheus/wiki/Default-port-allocations)
  1279  to avoid collisions with other prometheus exporters and services.
  1280  
  1281  If you are running a prometheus server you can add this address to your scrape configs
  1282  to have prometheus collect metrics on Docker.  For more information
  1283  on prometheus refer to the [prometheus website](https://prometheus.io/).
  1284  
  1285  ```yaml
  1286  scrape_configs:
  1287    - job_name: 'docker'
  1288      static_configs:
  1289        - targets: ['127.0.0.1:9323']
  1290  ```
  1291  
  1292  Please note that this feature is still marked as experimental as metrics and metric
  1293  names could change while this feature is still in experimental.  Please provide
  1294  feedback on what you would like to see collected in the API.
  1295  
  1296  #### Node Generic Resources
  1297  
  1298  The `--node-generic-resources` option takes a list of key-value
  1299  pair (`key=value`) that allows you to advertise user defined resources
  1300  in a swarm cluster.
  1301  
  1302  The current expected use case is to advertise NVIDIA GPUs so that services
  1303  requesting `NVIDIA-GPU=[0-16]` can land on a node that has enough GPUs for
  1304  the task to run.
  1305  
  1306  Example of usage:
  1307  ```json
  1308  {
  1309    "node-generic-resources": [
  1310      "NVIDIA-GPU=UUID1",
  1311      "NVIDIA-GPU=UUID2"
  1312    ]
  1313  }
  1314  ```
  1315  
  1316  ### Daemon configuration file
  1317  
  1318  The `--config-file` option allows you to set any configuration option
  1319  for the daemon in a JSON format. This file uses the same flag names as keys,
  1320  except for flags that allow several entries, where it uses the plural
  1321  of the flag name, e.g., `labels` for the `label` flag.
  1322  
  1323  The options set in the configuration file must not conflict with options set
  1324  via flags. The docker daemon fails to start if an option is duplicated between
  1325  the file and the flags, regardless their value. We do this to avoid
  1326  silently ignore changes introduced in configuration reloads.
  1327  For example, the daemon fails to start if you set daemon labels
  1328  in the configuration file and also set daemon labels via the `--label` flag.
  1329  Options that are not present in the file are ignored when the daemon starts.
  1330  
  1331  ##### On Linux
  1332  
  1333  The default location of the configuration file on Linux is
  1334  `/etc/docker/daemon.json`. The `--config-file` flag can be used to specify a
  1335   non-default location.
  1336  
  1337  This is a full example of the allowed configuration options on Linux:
  1338  
  1339  ```json
  1340  {
  1341    "allow-nondistributable-artifacts": [],
  1342    "api-cors-header": "",
  1343    "authorization-plugins": [],
  1344    "bip": "",
  1345    "bridge": "",
  1346    "cgroup-parent": "",
  1347    "cluster-advertise": "",
  1348    "cluster-store": "",
  1349    "cluster-store-opts": {},
  1350    "containerd": "/run/containerd/containerd.sock",
  1351    "containerd-namespace": "docker",
  1352    "containerd-plugin-namespace": "docker-plugins",
  1353    "data-root": "",
  1354    "debug": true,
  1355    "default-address-pools": [
  1356      {
  1357        "base": "172.80.0.0/16",
  1358        "size": 24
  1359      },
  1360      {
  1361        "base": "172.90.0.0/16",
  1362        "size": 24
  1363      }
  1364    ],
  1365    "default-cgroupns-mode": "private",
  1366    "default-gateway": "",
  1367    "default-gateway-v6": "",
  1368    "default-runtime": "runc",
  1369    "default-shm-size": "64M",
  1370    "default-ulimits": {
  1371      "nofile": {
  1372        "Hard": 64000,
  1373        "Name": "nofile",
  1374        "Soft": 64000
  1375      }
  1376    },
  1377    "dns": [],
  1378    "dns-opts": [],
  1379    "dns-search": [],
  1380    "exec-opts": [],
  1381    "exec-root": "",
  1382    "experimental": false,
  1383    "features": {},
  1384    "fixed-cidr": "",
  1385    "fixed-cidr-v6": "",
  1386    "group": "",
  1387    "hosts": [],
  1388    "icc": false,
  1389    "init": false,
  1390    "init-path": "/usr/libexec/docker-init",
  1391    "insecure-registries": [],
  1392    "ip": "0.0.0.0",
  1393    "ip-forward": false,
  1394    "ip-masq": false,
  1395    "iptables": false,
  1396    "ip6tables": false,
  1397    "ipv6": false,
  1398    "labels": [],
  1399    "live-restore": true,
  1400    "log-driver": "json-file",
  1401    "log-level": "",
  1402    "log-opts": {
  1403      "env": "os,customer",
  1404      "labels": "somelabel",
  1405      "max-file": "5",
  1406      "max-size": "10m"
  1407    },
  1408    "max-concurrent-downloads": 3,
  1409    "max-concurrent-uploads": 5,
  1410    "max-download-attempts": 5,
  1411    "mtu": 0,
  1412    "no-new-privileges": false,
  1413    "node-generic-resources": [
  1414      "NVIDIA-GPU=UUID1",
  1415      "NVIDIA-GPU=UUID2"
  1416    ],
  1417    "oom-score-adjust": -500,
  1418    "pidfile": "",
  1419    "raw-logs": false,
  1420    "registry-mirrors": [],
  1421    "runtimes": {
  1422      "cc-runtime": {
  1423        "path": "/usr/bin/cc-runtime"
  1424      },
  1425      "custom": {
  1426        "path": "/usr/local/bin/my-runc-replacement",
  1427        "runtimeArgs": [
  1428          "--debug"
  1429        ]
  1430      }
  1431    },
  1432    "seccomp-profile": "",
  1433    "selinux-enabled": false,
  1434    "shutdown-timeout": 15,
  1435    "storage-driver": "",
  1436    "storage-opts": [],
  1437    "swarm-default-advertise-addr": "",
  1438    "tls": true,
  1439    "tlscacert": "",
  1440    "tlscert": "",
  1441    "tlskey": "",
  1442    "tlsverify": true,
  1443    "userland-proxy": false,
  1444    "userland-proxy-path": "/usr/libexec/docker-proxy",
  1445    "userns-remap": ""
  1446  }
  1447  ```
  1448  
  1449  > **Note:**
  1450  >
  1451  > You cannot set options in `daemon.json` that have already been set on
  1452  > daemon startup as a flag.
  1453  > On systems that use `systemd` to start the Docker daemon, `-H` is already set, so
  1454  > you cannot use the `hosts` key in `daemon.json` to add listening addresses.
  1455  > See https://docs.docker.com/engine/admin/systemd/#custom-docker-daemon-options for how
  1456  > to accomplish this task with a systemd drop-in file.
  1457  
  1458  ##### On Windows
  1459  
  1460  The default location of the configuration file on Windows is
  1461   `%programdata%\docker\config\daemon.json`. The `--config-file` flag can be
  1462   used to specify a non-default location.
  1463  
  1464  This is a full example of the allowed configuration options on Windows:
  1465  
  1466  ```json
  1467  {
  1468    "allow-nondistributable-artifacts": [],
  1469    "authorization-plugins": [],
  1470    "bridge": "",
  1471    "cluster-advertise": "",
  1472    "cluster-store": "",
  1473    "containerd": "\\\\.\\pipe\\containerd-containerd",
  1474    "containerd-namespace": "docker",
  1475    "containerd-plugin-namespace": "docker-plugins",
  1476    "data-root": "",
  1477    "debug": true,
  1478    "default-ulimits": {},
  1479    "dns": [],
  1480    "dns-opts": [],
  1481    "dns-search": [],
  1482    "exec-opts": [],
  1483    "experimental": false,
  1484    "features": {},
  1485    "fixed-cidr": "",
  1486    "group": "",
  1487    "hosts": [],
  1488    "insecure-registries": [],
  1489    "labels": [],
  1490    "log-driver": "",
  1491    "log-level": "",
  1492    "max-concurrent-downloads": 3,
  1493    "max-concurrent-uploads": 5,
  1494    "max-download-attempts": 5,
  1495    "mtu": 0,
  1496    "pidfile": "",
  1497    "raw-logs": false,
  1498    "registry-mirrors": [],
  1499    "shutdown-timeout": 15,
  1500    "storage-driver": "",
  1501    "storage-opts": [],
  1502    "swarm-default-advertise-addr": "",
  1503    "tlscacert": "",
  1504    "tlscert": "",
  1505    "tlskey": "",
  1506    "tlsverify": true
  1507  }
  1508  ```
  1509  
  1510  #### Feature options
  1511  The optional field `features` in `daemon.json` allows users to enable or disable specific
  1512  daemon features. For example, `{"features":{"buildkit": true}}` enables `buildkit` as the
  1513  default docker image builder.
  1514  
  1515  The list of currently supported feature options:
  1516  - `buildkit`: It enables `buildkit` as default builder when set to `true` or disables it by
  1517  `false`. Note that if this option is not explicitly set in the daemon config file, then it
  1518  is up to the cli to determine which builder to invoke.
  1519  
  1520  #### Configuration reload behavior
  1521  
  1522  Some options can be reconfigured when the daemon is running without requiring
  1523  to restart the process. We use the `SIGHUP` signal in Linux to reload, and a global event
  1524  in Windows with the key `Global\docker-daemon-config-$PID`. The options can
  1525  be modified in the configuration file but still will check for conflicts with
  1526  the provided flags. The daemon fails to reconfigure itself
  1527  if there are conflicts, but it won't stop execution.
  1528  
  1529  The list of currently supported options that can be reconfigured is this:
  1530  
  1531  - `debug`: it changes the daemon to debug mode when set to true.
  1532  - `cluster-store`: it reloads the discovery store with the new address.
  1533  - `cluster-store-opts`: it uses the new options to reload the discovery store.
  1534  - `cluster-advertise`: it modifies the address advertised after reloading.
  1535  - `labels`: it replaces the daemon labels with a new set of labels.
  1536  - `live-restore`: Enables [keeping containers alive during daemon downtime](https://docs.docker.com/config/containers/live-restore/).
  1537  - `max-concurrent-downloads`: it updates the max concurrent downloads for each pull.
  1538  - `max-concurrent-uploads`: it updates the max concurrent uploads for each push.
  1539  - `max-download-attempts`: it updates the max download attempts for each pull.
  1540  - `default-runtime`: it updates the runtime to be used if not is
  1541    specified at container creation. It defaults to "default" which is
  1542    the runtime shipped with the official docker packages.
  1543  - `runtimes`: it updates the list of available OCI runtimes that can
  1544    be used to run containers.
  1545  - `authorization-plugin`: it specifies the authorization plugins to use.
  1546  - `allow-nondistributable-artifacts`: Replaces the set of registries to which the daemon will push nondistributable artifacts with a new set of registries.
  1547  - `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 resgitries, these existing ones will be removed from daemon's config.
  1548  - `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.
  1549  - `shutdown-timeout`: it replaces the daemon's existing configuration timeout with a new timeout for shutting down all containers.
  1550  - `features`: it explicitly enables or disables specific features.
  1551  
  1552  Updating and reloading the cluster configurations such as `--cluster-store`,
  1553  `--cluster-advertise` and `--cluster-store-opts` will take effect only if
  1554  these configurations were not previously configured. If `--cluster-store`
  1555  has been provided in flags and `cluster-advertise` not, `cluster-advertise`
  1556  can be added in the configuration file without accompanied by `--cluster-store`.
  1557  Configuration reload will log a warning message if it detects a change in
  1558  previously configured cluster configurations.
  1559  
  1560  
  1561  ### Run multiple daemons
  1562  
  1563  > **Note:** Running multiple daemons on a single host is considered as "experimental". The user should be aware of
  1564  > unsolved problems. This solution may not work properly in some cases. Solutions are currently under development
  1565  > and will be delivered in the near future.
  1566  
  1567  This section describes how to run multiple Docker daemons on a single host. To
  1568  run multiple daemons, you must configure each daemon so that it does not
  1569  conflict with other daemons on the same host. You can set these options either
  1570  by providing them as flags, or by using a [daemon configuration file](#daemon-configuration-file).
  1571  
  1572  The following daemon options must be configured for each daemon:
  1573  
  1574  ```console
  1575  -b, --bridge=                          Attach containers to a network bridge
  1576  --exec-root=/var/run/docker            Root of the Docker execdriver
  1577  --data-root=/var/lib/docker            Root of persisted Docker data
  1578  -p, --pidfile=/var/run/docker.pid      Path to use for daemon PID file
  1579  -H, --host=[]                          Daemon socket(s) to connect to
  1580  --iptables=true                        Enable addition of iptables rules
  1581  --config-file=/etc/docker/daemon.json  Daemon configuration file
  1582  --tlscacert="~/.docker/ca.pem"         Trust certs signed only by this CA
  1583  --tlscert="~/.docker/cert.pem"         Path to TLS certificate file
  1584  --tlskey="~/.docker/key.pem"           Path to TLS key file
  1585  ```
  1586  
  1587  When your daemons use different values for these flags, you can run them on the same host without any problems.
  1588  It is very important to properly understand the meaning of those options and to use them correctly.
  1589  
  1590  - The `-b, --bridge=` flag is set to `docker0` as default bridge network. It is created automatically when you install Docker.
  1591  If you are not using the default, you must create and configure the bridge manually or just set it to 'none': `--bridge=none`
  1592  - `--exec-root` is the path where the container state is stored. The default value is `/var/run/docker`. Specify the path for
  1593  your running daemon here.
  1594  - `--data-root` is the path where persisted data such as images, volumes, and
  1595  cluster state are stored. The default value is `/var/lib/docker`. To avoid any
  1596  conflict with other daemons, set this parameter separately for each daemon.
  1597  - `-p, --pidfile=/var/run/docker.pid` is the path where the process ID of the daemon is stored. Specify the path for your
  1598  pid file here.
  1599  - `--host=[]` specifies where the Docker daemon will listen for client connections. If unspecified, it defaults to `/data/docker/run/docker.sock`.
  1600  -  `--iptables=false` prevents the Docker daemon from adding iptables rules. If
  1601  multiple daemons manage iptables rules, they may overwrite rules set by another
  1602  daemon. Be aware that disabling this option requires you to manually add
  1603  iptables rules to expose container ports. If you prevent Docker from adding
  1604  iptables rules, Docker will also not add IP masquerading rules, even if you set
  1605  `--ip-masq` to `true`. Without IP masquerading rules, Docker containers will not be
  1606  able to connect to external hosts or the internet when using network other than
  1607  default bridge.
  1608  - `--config-file=/etc/docker/daemon.json` is the path where configuration file is stored. You can use it instead of
  1609  daemon flags. Specify the path for each daemon.
  1610  - `--tls*` Docker daemon supports `--tlsverify` mode that enforces encrypted and authenticated remote connections.
  1611  The `--tls*` options enable use of specific certificates for individual daemons.
  1612  
  1613  Example script for a separate “bootstrap” instance of the Docker daemon without network:
  1614  
  1615  ```bash
  1616  $ sudo dockerd \
  1617          -H unix:///var/run/docker-bootstrap.sock \
  1618          -p /var/run/docker-bootstrap.pid \
  1619          --iptables=false \
  1620          --ip-masq=false \
  1621          --bridge=none \
  1622          --data-root=/var/lib/docker-bootstrap \
  1623          --exec-root=/var/run/docker-bootstrap
  1624  ```