github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/docs/reference/commandline/dockerd.md (about)

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