github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/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 (default 3)
    81        --max-concurrent-uploads int            Set the max concurrent uploads (default 5)
    82        --max-download-attempts int             Set the max download attempts for each pull (default 5)
    83        --metrics-addr string                   Set default address and port to serve the metrics api on
    84        --mtu int                               Set the containers network MTU
    85        --network-control-plane-mtu int         Network Control plane MTU (default 1500)
    86        --no-new-privileges                     Set no-new-privileges by default for new containers
    87        --node-generic-resource list            Advertise user-defined resource
    88        --oom-score-adjust int                  Set the oom_score_adj for the daemon (default -500)
    89    -p, --pidfile string                        Path to use for daemon PID file (default "/var/run/docker.pid")
    90        --raw-logs                              Full timestamps without ANSI coloring
    91        --registry-mirror list                  Preferred 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.size`
   824  
   825  Sets the default max size of the container. It is supported only when the
   826  backing fs is `xfs` and mounted with `pquota` mount option. Under these
   827  conditions the user can pass any size less than the backing fs size.
   828  
   829  ###### Example
   830  
   831  ```console
   832  $ sudo dockerd -s overlay2 --storage-opt overlay2.size=1G
   833  ```
   834  
   835  
   836  #### Windowsfilter options
   837  
   838  ##### `size`
   839  
   840  Specifies the size to use when creating the sandbox which is used for containers.
   841  Defaults to 20G.
   842  
   843  ###### Example
   844  
   845  ```powershell
   846  C:\> dockerd --storage-opt size=40G
   847  ```
   848  
   849  #### LCOW (Linux Containers on Windows) options
   850  
   851  ##### `lcow.globalmode`
   852  
   853  Specifies whether the daemon instantiates utility VM instances as required
   854  (recommended and default if omitted), or uses single global utility VM (better
   855  performance, but has security implications and not recommended for production
   856  deployments).
   857  
   858  ###### Example
   859  
   860  ```powershell
   861  C:\> dockerd --storage-opt lcow.globalmode=false
   862  ```
   863  
   864  ##### `lcow.kirdpath`
   865  
   866  Specifies the folder path to the location of a pair of kernel and initrd files
   867  used for booting a utility VM. Defaults to `%ProgramFiles%\Linux Containers`.
   868  
   869  ###### Example
   870  
   871  ```powershell
   872  C:\> dockerd --storage-opt lcow.kirdpath=c:\path\to\files
   873  ```
   874  
   875  ##### `lcow.kernel`
   876  
   877  Specifies the filename of a kernel file located in the `lcow.kirdpath` path.
   878  Defaults to `bootx64.efi`.
   879  
   880  ###### Example
   881  
   882  ```powershell
   883  C:\> dockerd --storage-opt lcow.kernel=kernel.efi
   884  ```
   885  
   886  ##### `lcow.initrd`
   887  
   888  Specifies the filename of an initrd file located in the `lcow.kirdpath` path.
   889  Defaults to `initrd.img`.
   890  
   891  ###### Example
   892  
   893  ```powershell
   894  C:\> dockerd --storage-opt lcow.initrd=myinitrd.img
   895  ```
   896  
   897  ##### `lcow.bootparameters`
   898  
   899  Specifies additional boot parameters for booting utility VMs when in kernel/
   900  initrd mode. Ignored if the utility VM is booting from VHD. These settings
   901  are kernel specific.
   902  
   903  ###### Example
   904  
   905  ```powershell
   906  C:\> dockerd --storage-opt "lcow.bootparameters='option=value'"
   907  ```
   908  
   909  ##### `lcow.vhdx`
   910  
   911  Specifies a custom VHDX to boot a utility VM, as an alternate to kernel
   912  and initrd booting. Defaults to `uvm.vhdx` under `lcow.kirdpath`.
   913  
   914  ###### Example
   915  
   916  ```powershell
   917  C:\> dockerd --storage-opt lcow.vhdx=custom.vhdx
   918  ```
   919  
   920  ##### `lcow.timeout`
   921  
   922  Specifies the timeout for utility VM operations in seconds. Defaults
   923  to 300.
   924  
   925  ###### Example
   926  
   927  ```powershell
   928  C:\> dockerd --storage-opt lcow.timeout=240
   929  ```
   930  
   931  ##### `lcow.sandboxsize`
   932  
   933  Specifies the size in GB to use when creating the sandbox which is used for
   934  containers. Defaults to 20. Cannot be less than 20.
   935  
   936  ###### Example
   937  
   938  ```powershell
   939  C:\> dockerd --storage-opt lcow.sandboxsize=40
   940  ```
   941  
   942  ### Docker runtime execution options
   943  
   944  The Docker daemon relies on a
   945  [OCI](https://github.com/opencontainers/runtime-spec) compliant runtime
   946  (invoked via the `containerd` daemon) as its interface to the Linux
   947  kernel `namespaces`, `cgroups`, and `SELinux`.
   948  
   949  By default, the Docker daemon automatically starts `containerd`. If you want to
   950  control `containerd` startup, manually start `containerd` and pass the path to
   951  the `containerd` socket using the `--containerd` flag. For example:
   952  
   953  ```console
   954  $ sudo dockerd --containerd /var/run/dev/docker-containerd.sock
   955  ```
   956  
   957  Runtimes can be registered with the daemon either via the
   958  configuration file or using the `--add-runtime` command line argument.
   959  
   960  The following is an example adding 2 runtimes via the configuration:
   961  
   962  ```json
   963  {
   964    "default-runtime": "runc",
   965    "runtimes": {
   966      "custom": {
   967        "path": "/usr/local/bin/my-runc-replacement",
   968        "runtimeArgs": [
   969          "--debug"
   970        ]
   971      },
   972      "runc": {
   973        "path": "runc"
   974      }
   975    }
   976  }
   977  ```
   978  
   979  This is the same example via the command line:
   980  
   981  ```console
   982  $ sudo dockerd --add-runtime runc=runc --add-runtime custom=/usr/local/bin/my-runc-replacement
   983  ```
   984  
   985  > **Note**
   986  >
   987  > Defining runtime arguments via the command line is not supported.
   988  
   989  #### Options for the runtime
   990  
   991  You can configure the runtime using options specified
   992  with the `--exec-opt` flag. All the flag's options have the `native` prefix. A
   993  single `native.cgroupdriver` option is available.
   994  
   995  The `native.cgroupdriver` option specifies the management of the container's
   996  cgroups. You can only specify `cgroupfs` or `systemd`. If you specify
   997  `systemd` and it is not available, the system errors out. If you omit the
   998  `native.cgroupdriver` option,` cgroupfs` is used on cgroup v1 hosts, `systemd`
   999  is used on cgroup v2 hosts with systemd available.
  1000  
  1001  This example sets the `cgroupdriver` to `systemd`:
  1002  
  1003  ```console
  1004  $ sudo dockerd --exec-opt native.cgroupdriver=systemd
  1005  ```
  1006  
  1007  Setting this option applies to all containers the daemon launches.
  1008  
  1009  Also Windows Container makes use of `--exec-opt` for special purpose. Docker user
  1010  can specify default container isolation technology with this, for example:
  1011  
  1012  ```console
  1013  > dockerd --exec-opt isolation=hyperv
  1014  ```
  1015  
  1016  Will make `hyperv` the default isolation technology on Windows. If no isolation
  1017  value is specified on daemon start, on Windows client, the default is
  1018  `hyperv`, and on Windows server, the default is `process`.
  1019  
  1020  ### Daemon DNS options
  1021  
  1022  To set the DNS server for all Docker containers, use:
  1023  
  1024  ```console
  1025  $ sudo dockerd --dns 8.8.8.8
  1026  ```
  1027  
  1028  To set the DNS search domain for all Docker containers, use:
  1029  
  1030  ```console
  1031  $ sudo dockerd --dns-search example.com
  1032  ```
  1033  
  1034  ### Allow push of nondistributable artifacts
  1035  
  1036  Some images (e.g., Windows base images) contain artifacts whose distribution is
  1037  restricted by license. When these images are pushed to a registry, restricted
  1038  artifacts are not included.
  1039  
  1040  To override this behavior for specific registries, use the
  1041  `--allow-nondistributable-artifacts` option in one of the following forms:
  1042  
  1043  * `--allow-nondistributable-artifacts myregistry:5000` tells the Docker daemon
  1044    to push nondistributable artifacts to myregistry:5000.
  1045  * `--allow-nondistributable-artifacts 10.1.0.0/16` tells the Docker daemon to
  1046    push nondistributable artifacts to all registries whose resolved IP address
  1047    is within the subnet described by the CIDR syntax.
  1048  
  1049  This option can be used multiple times.
  1050  
  1051  This option is useful when pushing images containing nondistributable artifacts
  1052  to a registry on an air-gapped network so hosts on that network can pull the
  1053  images without connecting to another server.
  1054  
  1055  > **Warning**: Nondistributable artifacts typically have restrictions on how
  1056  > and where they can be distributed and shared. Only use this feature to push
  1057  > artifacts to private registries and ensure that you are in compliance with
  1058  > any terms that cover redistributing nondistributable artifacts.
  1059  
  1060  ### Insecure registries
  1061  
  1062  Docker considers a private registry either secure or insecure. In the rest of
  1063  this section, *registry* is used for *private registry*, and `myregistry:5000`
  1064  is a placeholder example for a private registry.
  1065  
  1066  A secure registry uses TLS and a copy of its CA certificate is placed on the
  1067  Docker host at `/etc/docker/certs.d/myregistry:5000/ca.crt`. An insecure
  1068  registry is either not using TLS (i.e., listening on plain text HTTP), or is
  1069  using TLS with a CA certificate not known by the Docker daemon. The latter can
  1070  happen when the certificate was not found under
  1071  `/etc/docker/certs.d/myregistry:5000/`, or if the certificate verification
  1072  failed (i.e., wrong CA).
  1073  
  1074  By default, Docker assumes all, but local (see local registries below),
  1075  registries are secure. Communicating with an insecure registry is not possible
  1076  if Docker assumes that registry is secure. In order to communicate with an
  1077  insecure registry, the Docker daemon requires `--insecure-registry` in one of
  1078  the following two forms:
  1079  
  1080  * `--insecure-registry myregistry:5000` tells the Docker daemon that
  1081    myregistry:5000 should be considered insecure.
  1082  * `--insecure-registry 10.1.0.0/16` tells the Docker daemon that all registries
  1083    whose domain resolve to an IP address is part of the subnet described by the
  1084    CIDR syntax, should be considered insecure.
  1085  
  1086  The flag can be used multiple times to allow multiple registries to be marked
  1087  as insecure.
  1088  
  1089  If an insecure registry is not marked as insecure, `docker pull`,
  1090  `docker push`, and `docker search` will result in an error message prompting
  1091  the user to either secure or pass the `--insecure-registry` flag to the Docker
  1092  daemon as described above.
  1093  
  1094  Local registries, whose IP address falls in the 127.0.0.0/8 range, are
  1095  automatically marked as insecure as of Docker 1.3.2. It is not recommended to
  1096  rely on this, as it may change in the future.
  1097  
  1098  Enabling `--insecure-registry`, i.e., allowing un-encrypted and/or untrusted
  1099  communication, can be useful when running a local registry.  However,
  1100  because its use creates security vulnerabilities it should ONLY be enabled for
  1101  testing purposes.  For increased security, users should add their CA to their
  1102  system's list of trusted CAs instead of enabling `--insecure-registry`.
  1103  
  1104  #### Legacy Registries
  1105  
  1106  Operations against registries supporting only the legacy v1 protocol are no longer
  1107  supported. Specifically, the daemon will not attempt `push`, `pull` and `login`
  1108  to v1 registries. The exception to this is `search` which can still be performed
  1109  on v1 registries.
  1110  
  1111  
  1112  ### Running a Docker daemon behind an HTTPS_PROXY
  1113  
  1114  When running inside a LAN that uses an `HTTPS` proxy, the Docker Hub
  1115  certificates will be replaced by the proxy's certificates. These certificates
  1116  need to be added to your Docker host's configuration:
  1117  
  1118  1. Install the `ca-certificates` package for your distribution
  1119  2. Ask your network admin for the proxy's CA certificate and append them to
  1120     `/etc/pki/tls/certs/ca-bundle.crt`
  1121  3. Then start your Docker daemon with `HTTPS_PROXY=http://username:password@proxy:port/ dockerd`.
  1122     The `username:` and `password@` are optional - and are only needed if your
  1123     proxy is set up to require authentication.
  1124  
  1125  This will only add the proxy and authentication to the Docker daemon's requests -
  1126  your `docker build`s and running containers will need extra configuration to
  1127  use the proxy
  1128  
  1129  ### Default `ulimit` settings
  1130  
  1131  `--default-ulimit` allows you to set the default `ulimit` options to use for
  1132  all containers. It takes the same options as `--ulimit` for `docker run`. If
  1133  these defaults are not set, `ulimit` settings will be inherited, if not set on
  1134  `docker run`, from the Docker daemon. Any `--ulimit` options passed to
  1135  `docker run` will overwrite these defaults.
  1136  
  1137  Be careful setting `nproc` with the `ulimit` flag as `nproc` is designed by Linux to
  1138  set the maximum number of processes available to a user, not to a container. For details
  1139  please check the [run](run.md) reference.
  1140  
  1141  ### Node discovery
  1142  
  1143  The `--cluster-advertise` option specifies the `host:port` or `interface:port`
  1144  combination that this particular daemon instance should use when advertising
  1145  itself to the cluster. The daemon is reached by remote hosts through this value.
  1146  If you  specify an interface, make sure it includes the IP address of the actual
  1147  Docker host. For Engine installation created through `docker-machine`, the
  1148  interface is typically `eth1`.
  1149  
  1150  The daemon uses [libkv](https://github.com/docker/libkv/) to advertise
  1151  the node within the cluster. Some key-value backends support mutual
  1152  TLS. To configure the client TLS settings used by the daemon can be configured
  1153  using the `--cluster-store-opt` flag, specifying the paths to PEM encoded
  1154  files. For example:
  1155  
  1156  ```console
  1157  $ sudo dockerd \
  1158      --cluster-advertise 192.168.1.2:2376 \
  1159      --cluster-store etcd://192.168.1.2:2379 \
  1160      --cluster-store-opt kv.cacertfile=/path/to/ca.pem \
  1161      --cluster-store-opt kv.certfile=/path/to/cert.pem \
  1162      --cluster-store-opt kv.keyfile=/path/to/key.pem
  1163  ```
  1164  
  1165  The currently supported cluster store options are:
  1166  
  1167  | Option                | Description                                                                                                                                                                                                                   |
  1168  |:----------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  1169  | `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.    |
  1170  | `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. |
  1171  | `kv.cacertfile`       | Specifies the path to a local file with PEM encoded CA certificates to trust.                                                                                                                                                 |
  1172  | `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.                                                                    |
  1173  | `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.                                                                     |
  1174  | `kv.path`             | Specifies the path in the Key/Value store. If not configured, the default value is 'docker/nodes'.                                                                                                                            |
  1175  
  1176  ### Access authorization
  1177  
  1178  Docker's access authorization can be extended by authorization plugins that your
  1179  organization can purchase or build themselves. You can install one or more
  1180  authorization plugins when you start the Docker `daemon` using the
  1181  `--authorization-plugin=PLUGIN_ID` option.
  1182  
  1183  ```console
  1184  $ sudo dockerd --authorization-plugin=plugin1 --authorization-plugin=plugin2,...
  1185  ```
  1186  
  1187  The `PLUGIN_ID` value is either the plugin's name or a path to its specification
  1188  file. The plugin's implementation determines whether you can specify a name or
  1189  path. Consult with your Docker administrator to get information about the
  1190  plugins available to you.
  1191  
  1192  Once a plugin is installed, requests made to the `daemon` through the
  1193  command line or Docker's Engine API are allowed or denied by the plugin.
  1194  If you have multiple plugins installed, each plugin, in order, must
  1195  allow the request for it to complete.
  1196  
  1197  For information about how to create an authorization plugin, refer to the
  1198  [authorization plugin](../../extend/plugins_authorization.md) section.
  1199  
  1200  
  1201  ### Daemon user namespace options
  1202  
  1203  The Linux kernel
  1204  [user namespace support](https://man7.org/linux/man-pages/man7/user_namespaces.7.html)
  1205  provides additional security by enabling a process, and therefore a container,
  1206  to have a unique range of user and group IDs which are outside the traditional
  1207  user and group range utilized by the host system. Potentially the most important
  1208  security improvement is that, by default, container processes running as the
  1209  `root` user will have expected administrative privilege (with some restrictions)
  1210  inside the container but will effectively be mapped to an unprivileged `uid` on
  1211  the host.
  1212  
  1213  For details about how to use this feature, as well as limitations, see
  1214  [Isolate containers with a user namespace](https://docs.docker.com/engine/security/userns-remap/).
  1215  
  1216  ### Miscellaneous options
  1217  
  1218  IP masquerading uses address translation to allow containers without a public
  1219  IP to talk to other machines on the Internet. This may interfere with some
  1220  network topologies and can be disabled with `--ip-masq=false`.
  1221  
  1222  Docker supports softlinks for the Docker data directory (`/var/lib/docker`) and
  1223  for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be
  1224  set like this:
  1225  
  1226  ```console
  1227  $ DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/dockerd --data-root /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1
  1228  ```
  1229  
  1230  or
  1231  
  1232  ```console
  1233  $ export DOCKER_TMPDIR=/mnt/disk2/tmp
  1234  $ /usr/local/bin/dockerd --data-root /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1
  1235  ````
  1236  
  1237  #### Default cgroup parent
  1238  
  1239  The `--cgroup-parent` option allows you to set the default cgroup parent
  1240  to use for containers. If this option is not set, it defaults to `/docker` for
  1241  fs cgroup driver and `system.slice` for systemd cgroup driver.
  1242  
  1243  If the cgroup has a leading forward slash (`/`), the cgroup is created
  1244  under the root cgroup, otherwise the cgroup is created under the daemon
  1245  cgroup.
  1246  
  1247  Assuming the daemon is running in cgroup `daemoncgroup`,
  1248  `--cgroup-parent=/foobar` creates a cgroup in
  1249  `/sys/fs/cgroup/memory/foobar`, whereas using `--cgroup-parent=foobar`
  1250  creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar`
  1251  
  1252  The systemd cgroup driver has different rules for `--cgroup-parent`. Systemd
  1253  represents hierarchy by slice and the name of the slice encodes the location in
  1254  the tree. So `--cgroup-parent` for systemd cgroups should be a slice name. A
  1255  name can consist of a dash-separated series of names, which describes the path
  1256  to the slice from the root slice. For example, `--cgroup-parent=user-a-b.slice`
  1257  means the memory cgroup for the container is created in
  1258  `/sys/fs/cgroup/memory/user.slice/user-a.slice/user-a-b.slice/docker-<id>.scope`.
  1259  
  1260  This setting can also be set per container, using the `--cgroup-parent`
  1261  option on `docker create` and `docker run`, and takes precedence over
  1262  the `--cgroup-parent` option on the daemon.
  1263  
  1264  #### Daemon metrics
  1265  
  1266  The `--metrics-addr` option takes a tcp address to serve the metrics API.
  1267  This feature is still experimental, therefore, the daemon must be running in experimental
  1268  mode for this feature to work.
  1269  
  1270  To serve the metrics API on `localhost:9323` you would specify `--metrics-addr 127.0.0.1:9323`,
  1271  allowing you to make requests on the API at `127.0.0.1:9323/metrics` to receive metrics in the
  1272  [prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) format.
  1273  
  1274  Port `9323` is the [default port associated with Docker
  1275  metrics](https://github.com/prometheus/prometheus/wiki/Default-port-allocations)
  1276  to avoid collisions with other prometheus exporters and services.
  1277  
  1278  If you are running a prometheus server you can add this address to your scrape configs
  1279  to have prometheus collect metrics on Docker.  For more information
  1280  on prometheus refer to the [prometheus website](https://prometheus.io/).
  1281  
  1282  ```yaml
  1283  scrape_configs:
  1284    - job_name: 'docker'
  1285      static_configs:
  1286        - targets: ['127.0.0.1:9323']
  1287  ```
  1288  
  1289  Please note that this feature is still marked as experimental as metrics and metric
  1290  names could change while this feature is still in experimental.  Please provide
  1291  feedback on what you would like to see collected in the API.
  1292  
  1293  #### Node Generic Resources
  1294  
  1295  The `--node-generic-resources` option takes a list of key-value
  1296  pair (`key=value`) that allows you to advertise user defined resources
  1297  in a swarm cluster.
  1298  
  1299  The current expected use case is to advertise NVIDIA GPUs so that services
  1300  requesting `NVIDIA-GPU=[0-16]` can land on a node that has enough GPUs for
  1301  the task to run.
  1302  
  1303  Example of usage:
  1304  ```json
  1305  {
  1306    "node-generic-resources": [
  1307      "NVIDIA-GPU=UUID1",
  1308      "NVIDIA-GPU=UUID2"
  1309    ]
  1310  }
  1311  ```
  1312  
  1313  ### Daemon configuration file
  1314  
  1315  The `--config-file` option allows you to set any configuration option
  1316  for the daemon in a JSON format. This file uses the same flag names as keys,
  1317  except for flags that allow several entries, where it uses the plural
  1318  of the flag name, e.g., `labels` for the `label` flag.
  1319  
  1320  The options set in the configuration file must not conflict with options set
  1321  via flags. The docker daemon fails to start if an option is duplicated between
  1322  the file and the flags, regardless their value. We do this to avoid
  1323  silently ignore changes introduced in configuration reloads.
  1324  For example, the daemon fails to start if you set daemon labels
  1325  in the configuration file and also set daemon labels via the `--label` flag.
  1326  Options that are not present in the file are ignored when the daemon starts.
  1327  
  1328  ##### On Linux
  1329  
  1330  The default location of the configuration file on Linux is
  1331  `/etc/docker/daemon.json`. The `--config-file` flag can be used to specify a
  1332   non-default location.
  1333  
  1334  This is a full example of the allowed configuration options on Linux:
  1335  
  1336  ```json
  1337  {
  1338    "allow-nondistributable-artifacts": [],
  1339    "api-cors-header": "",
  1340    "authorization-plugins": [],
  1341    "bip": "",
  1342    "bridge": "",
  1343    "cgroup-parent": "",
  1344    "cluster-advertise": "",
  1345    "cluster-store": "",
  1346    "cluster-store-opts": {},
  1347    "containerd": "/run/containerd/containerd.sock",
  1348    "containerd-namespace": "docker",
  1349    "containerd-plugin-namespace": "docker-plugins",
  1350    "data-root": "",
  1351    "debug": true,
  1352    "default-address-pools": [
  1353      {
  1354        "base": "172.30.0.0/16",
  1355        "size": 24
  1356      },
  1357      {
  1358        "base": "172.31.0.0/16",
  1359        "size": 24
  1360      }
  1361    ],
  1362    "default-cgroupns-mode": "private",
  1363    "default-gateway": "",
  1364    "default-gateway-v6": "",
  1365    "default-runtime": "runc",
  1366    "default-shm-size": "64M",
  1367    "default-ulimits": {
  1368      "nofile": {
  1369        "Hard": 64000,
  1370        "Name": "nofile",
  1371        "Soft": 64000
  1372      }
  1373    },
  1374    "dns": [],
  1375    "dns-opts": [],
  1376    "dns-search": [],
  1377    "exec-opts": [],
  1378    "exec-root": "",
  1379    "experimental": false,
  1380    "features": {},
  1381    "fixed-cidr": "",
  1382    "fixed-cidr-v6": "",
  1383    "group": "",
  1384    "hosts": [],
  1385    "icc": false,
  1386    "init": false,
  1387    "init-path": "/usr/libexec/docker-init",
  1388    "insecure-registries": [],
  1389    "ip": "0.0.0.0",
  1390    "ip-forward": false,
  1391    "ip-masq": false,
  1392    "iptables": false,
  1393    "ip6tables": false,
  1394    "ipv6": false,
  1395    "labels": [],
  1396    "live-restore": true,
  1397    "log-driver": "json-file",
  1398    "log-level": "",
  1399    "log-opts": {
  1400      "cache-disabled": "false",
  1401      "cache-max-file": "5",
  1402      "cache-max-size": "20m",
  1403      "cache-compress": "true",
  1404      "env": "os,customer",
  1405      "labels": "somelabel",
  1406      "max-file": "5",
  1407      "max-size": "10m"
  1408    },
  1409    "max-concurrent-downloads": 3,
  1410    "max-concurrent-uploads": 5,
  1411    "max-download-attempts": 5,
  1412    "mtu": 0,
  1413    "no-new-privileges": false,
  1414    "node-generic-resources": [
  1415      "NVIDIA-GPU=UUID1",
  1416      "NVIDIA-GPU=UUID2"
  1417    ],
  1418    "oom-score-adjust": -500,
  1419    "pidfile": "",
  1420    "raw-logs": false,
  1421    "registry-mirrors": [],
  1422    "runtimes": {
  1423      "cc-runtime": {
  1424        "path": "/usr/bin/cc-runtime"
  1425      },
  1426      "custom": {
  1427        "path": "/usr/local/bin/my-runc-replacement",
  1428        "runtimeArgs": [
  1429          "--debug"
  1430        ]
  1431      }
  1432    },
  1433    "seccomp-profile": "",
  1434    "selinux-enabled": false,
  1435    "shutdown-timeout": 15,
  1436    "storage-driver": "",
  1437    "storage-opts": [],
  1438    "swarm-default-advertise-addr": "",
  1439    "tls": true,
  1440    "tlscacert": "",
  1441    "tlscert": "",
  1442    "tlskey": "",
  1443    "tlsverify": true,
  1444    "userland-proxy": false,
  1445    "userland-proxy-path": "/usr/libexec/docker-proxy",
  1446    "userns-remap": ""
  1447  }
  1448  ```
  1449  
  1450  > **Note:**
  1451  >
  1452  > You cannot set options in `daemon.json` that have already been set on
  1453  > daemon startup as a flag.
  1454  > On systems that use `systemd` to start the Docker daemon, `-H` is already set, so
  1455  > you cannot use the `hosts` key in `daemon.json` to add listening addresses.
  1456  > See ["custom Docker daemon options"](https://docs.docker.com/config/daemon/systemd/#custom-docker-daemon-options) for how
  1457  > to accomplish this task with a systemd drop-in file.
  1458  
  1459  ##### On Windows
  1460  
  1461  The default location of the configuration file on Windows is
  1462   `%programdata%\docker\config\daemon.json`. The `--config-file` flag can be
  1463   used to specify a non-default location.
  1464  
  1465  This is a full example of the allowed configuration options on Windows:
  1466  
  1467  ```json
  1468  {
  1469    "allow-nondistributable-artifacts": [],
  1470    "authorization-plugins": [],
  1471    "bridge": "",
  1472    "cluster-advertise": "",
  1473    "cluster-store": "",
  1474    "containerd": "\\\\.\\pipe\\containerd-containerd",
  1475    "containerd-namespace": "docker",
  1476    "containerd-plugin-namespace": "docker-plugins",
  1477    "data-root": "",
  1478    "debug": true,
  1479    "default-ulimits": {},
  1480    "dns": [],
  1481    "dns-opts": [],
  1482    "dns-search": [],
  1483    "exec-opts": [],
  1484    "experimental": false,
  1485    "features": {},
  1486    "fixed-cidr": "",
  1487    "group": "",
  1488    "hosts": [],
  1489    "insecure-registries": [],
  1490    "labels": [],
  1491    "log-driver": "",
  1492    "log-level": "",
  1493    "max-concurrent-downloads": 3,
  1494    "max-concurrent-uploads": 5,
  1495    "max-download-attempts": 5,
  1496    "mtu": 0,
  1497    "pidfile": "",
  1498    "raw-logs": false,
  1499    "registry-mirrors": [],
  1500    "shutdown-timeout": 15,
  1501    "storage-driver": "",
  1502    "storage-opts": [],
  1503    "swarm-default-advertise-addr": "",
  1504    "tlscacert": "",
  1505    "tlscert": "",
  1506    "tlskey": "",
  1507    "tlsverify": true
  1508  }
  1509  ```
  1510  
  1511  #### Feature options
  1512  The optional field `features` in `daemon.json` allows users to enable or disable specific
  1513  daemon features. For example, `{"features":{"buildkit": true}}` enables `buildkit` as the
  1514  default docker image builder.
  1515  
  1516  The list of currently supported feature options:
  1517  - `buildkit`: It enables `buildkit` as default builder when set to `true` or disables it by
  1518  `false`. Note that if this option is not explicitly set in the daemon config file, then it
  1519  is up to the cli to determine which builder to invoke.
  1520  
  1521  #### Configuration reload behavior
  1522  
  1523  Some options can be reconfigured when the daemon is running without requiring
  1524  to restart the process. We use the `SIGHUP` signal in Linux to reload, and a global event
  1525  in Windows with the key `Global\docker-daemon-config-$PID`. The options can
  1526  be modified in the configuration file but still will check for conflicts with
  1527  the provided flags. The daemon fails to reconfigure itself
  1528  if there are conflicts, but it won't stop execution.
  1529  
  1530  The list of currently supported options that can be reconfigured is this:
  1531  
  1532  - `debug`: it changes the daemon to debug mode when set to true.
  1533  - `cluster-store`: it reloads the discovery store with the new address.
  1534  - `cluster-store-opts`: it uses the new options to reload the discovery store.
  1535  - `cluster-advertise`: it modifies the address advertised after reloading.
  1536  - `labels`: it replaces the daemon labels with a new set of labels.
  1537  - `live-restore`: Enables [keeping containers alive during daemon downtime](https://docs.docker.com/config/containers/live-restore/).
  1538  - `max-concurrent-downloads`: it updates the max concurrent downloads for each pull.
  1539  - `max-concurrent-uploads`: it updates the max concurrent uploads for each push.
  1540  - `max-download-attempts`: it updates the max download attempts for each pull.
  1541  - `default-runtime`: it updates the runtime to be used if not is
  1542    specified at container creation. It defaults to "default" which is
  1543    the runtime shipped with the official docker packages.
  1544  - `runtimes`: it updates the list of available OCI runtimes that can
  1545    be used to run containers.
  1546  - `authorization-plugin`: it specifies the authorization plugins to use.
  1547  - `allow-nondistributable-artifacts`: Replaces the set of registries to which the daemon will push nondistributable artifacts with a new set of registries.
  1548  - `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.
  1549  - `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.
  1550  - `shutdown-timeout`: it replaces the daemon's existing configuration timeout with a new timeout for shutting down all containers.
  1551  - `features`: it explicitly enables or disables specific features.
  1552  
  1553  Updating and reloading the cluster configurations such as `--cluster-store`,
  1554  `--cluster-advertise` and `--cluster-store-opts` will take effect only if
  1555  these configurations were not previously configured. If `--cluster-store`
  1556  has been provided in flags and `cluster-advertise` not, `cluster-advertise`
  1557  can be added in the configuration file without accompanied by `--cluster-store`.
  1558  Configuration reload will log a warning message if it detects a change in
  1559  previously configured cluster configurations.
  1560  
  1561  
  1562  ### Run multiple daemons
  1563  
  1564  > **Note:**
  1565  >
  1566  > Running multiple daemons on a single host is considered as "experimental". The user should be aware of
  1567  > unsolved problems. This solution may not work properly in some cases. Solutions are currently under development
  1568  > and will be delivered in the near future.
  1569  
  1570  This section describes how to run multiple Docker daemons on a single host. To
  1571  run multiple daemons, you must configure each daemon so that it does not
  1572  conflict with other daemons on the same host. You can set these options either
  1573  by providing them as flags, or by using a [daemon configuration file](#daemon-configuration-file).
  1574  
  1575  The following daemon options must be configured for each daemon:
  1576  
  1577  ```console
  1578  -b, --bridge=                          Attach containers to a network bridge
  1579  --exec-root=/var/run/docker            Root of the Docker execdriver
  1580  --data-root=/var/lib/docker            Root of persisted Docker data
  1581  -p, --pidfile=/var/run/docker.pid      Path to use for daemon PID file
  1582  -H, --host=[]                          Daemon socket(s) to connect to
  1583  --iptables=true                        Enable addition of iptables rules
  1584  --config-file=/etc/docker/daemon.json  Daemon configuration file
  1585  --tlscacert="~/.docker/ca.pem"         Trust certs signed only by this CA
  1586  --tlscert="~/.docker/cert.pem"         Path to TLS certificate file
  1587  --tlskey="~/.docker/key.pem"           Path to TLS key file
  1588  ```
  1589  
  1590  When your daemons use different values for these flags, you can run them on the same host without any problems.
  1591  It is very important to properly understand the meaning of those options and to use them correctly.
  1592  
  1593  - The `-b, --bridge=` flag is set to `docker0` as default bridge network. It is created automatically when you install Docker.
  1594  If you are not using the default, you must create and configure the bridge manually or just set it to 'none': `--bridge=none`
  1595  - `--exec-root` is the path where the container state is stored. The default value is `/var/run/docker`. Specify the path for
  1596  your running daemon here.
  1597  - `--data-root` is the path where persisted data such as images, volumes, and
  1598  cluster state are stored. The default value is `/var/lib/docker`. To avoid any
  1599  conflict with other daemons, set this parameter separately for each daemon.
  1600  - `-p, --pidfile=/var/run/docker.pid` is the path where the process ID of the daemon is stored. Specify the path for your
  1601  pid file here.
  1602  - `--host=[]` specifies where the Docker daemon will listen for client connections. If unspecified, it defaults to `/var/run/docker.sock`.
  1603  -  `--iptables=false` prevents the Docker daemon from adding iptables rules. If
  1604  multiple daemons manage iptables rules, they may overwrite rules set by another
  1605  daemon. Be aware that disabling this option requires you to manually add
  1606  iptables rules to expose container ports. If you prevent Docker from adding
  1607  iptables rules, Docker will also not add IP masquerading rules, even if you set
  1608  `--ip-masq` to `true`. Without IP masquerading rules, Docker containers will not be
  1609  able to connect to external hosts or the internet when using network other than
  1610  default bridge.
  1611  - `--config-file=/etc/docker/daemon.json` is the path where configuration file is stored. You can use it instead of
  1612  daemon flags. Specify the path for each daemon.
  1613  - `--tls*` Docker daemon supports `--tlsverify` mode that enforces encrypted and authenticated remote connections.
  1614  The `--tls*` options enable use of specific certificates for individual daemons.
  1615  
  1616  Example script for a separate “bootstrap” instance of the Docker daemon without network:
  1617  
  1618  ```console
  1619  $ sudo dockerd \
  1620          -H unix:///var/run/docker-bootstrap.sock \
  1621          -p /var/run/docker-bootstrap.pid \
  1622          --iptables=false \
  1623          --ip-masq=false \
  1624          --bridge=none \
  1625          --data-root=/var/lib/docker-bootstrap \
  1626          --exec-root=/var/run/docker-bootstrap
  1627  ```