github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/docs/reference/commandline/daemon.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "daemon"
     4  description = "The daemon command description and usage"
     5  keywords = ["container, daemon, runtime"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  weight = -1
     9  +++
    10  <![end-metadata]-->
    11  
    12  # daemon
    13  
    14      Usage: docker daemon [OPTIONS]
    15  
    16      A self-sufficient runtime for linux containers.
    17  
    18      Options:
    19        --api-cors-header=""                   Set CORS headers in the remote API
    20        --authorization-plugin=[]              Set authorization plugins to load
    21        -b, --bridge=""                        Attach containers to a network bridge
    22        --bip=""                               Specify network bridge IP
    23        --cgroup-parent=                       Set parent cgroup for all containers
    24        -D, --debug                            Enable debug mode
    25        --default-gateway=""                   Container default gateway IPv4 address
    26        --default-gateway-v6=""                Container default gateway IPv6 address
    27        --cluster-store=""                     URL of the distributed storage backend
    28        --cluster-advertise=""                 Address of the daemon instance on the cluster
    29        --cluster-store-opt=map[]              Set cluster options
    30        --config-file=/etc/docker/daemon.json  Daemon configuration file
    31        --dns=[]                               DNS server to use
    32        --dns-opt=[]                           DNS options to use
    33        --dns-search=[]                        DNS search domains to use
    34        --default-ulimit=[]                    Set default ulimit settings for containers
    35        --exec-opt=[]                          Set exec driver options
    36        --exec-root="/var/run/docker"          Root of the Docker execdriver
    37        --fixed-cidr=""                        IPv4 subnet for fixed IPs
    38        --fixed-cidr-v6=""                     IPv6 subnet for fixed IPs
    39        -G, --group="docker"                   Group for the unix socket
    40        -g, --graph="/var/lib/docker"          Root of the Docker runtime
    41        -H, --host=[]                          Daemon socket(s) to connect to
    42        --help                                 Print usage
    43        --icc=true                             Enable inter-container communication
    44        --insecure-registry=[]                 Enable insecure registry communication
    45        --ip=0.0.0.0                           Default IP when binding container ports
    46        --ip-forward=true                      Enable net.ipv4.ip_forward
    47        --ip-masq=true                         Enable IP masquerading
    48        --iptables=true                        Enable addition of iptables rules
    49        --ipv6                                 Enable IPv6 networking
    50        -l, --log-level="info"                 Set the logging level
    51        --label=[]                             Set key=value labels to the daemon
    52        --log-driver="json-file"               Default driver for container logs
    53        --log-opt=[]                           Log driver specific options
    54        --mtu=0                                Set the containers network MTU
    55        --disable-legacy-registry              Do not contact legacy registries
    56        -p, --pidfile="/var/run/docker.pid"    Path to use for daemon PID file
    57        --raw-logs                             Full timestamps without ANSI coloring
    58        --registry-mirror=[]                   Preferred Docker registry mirror
    59        -s, --storage-driver=""                Storage driver to use
    60        --selinux-enabled                      Enable selinux support
    61        --storage-opt=[]                       Set storage driver options
    62        --tls                                  Use TLS; implied by --tlsverify
    63        --tlscacert="~/.docker/ca.pem"         Trust certs signed only by this CA
    64        --tlscert="~/.docker/cert.pem"         Path to TLS certificate file
    65        --tlskey="~/.docker/key.pem"           Path to TLS key file
    66        --tlsverify                            Use TLS and verify the remote
    67        --userns-remap="default"               Enable user namespace remapping
    68        --userland-proxy=true                  Use userland proxy for loopback traffic
    69  
    70  Options with [] may be specified multiple times.
    71  
    72  The Docker daemon is the persistent process that manages containers. Docker
    73  uses the same binary for both the daemon and client. To run the daemon you
    74  type `docker daemon`.
    75  
    76  To run the daemon with debug output, use `docker daemon -D`.
    77  
    78  ## Daemon socket option
    79  
    80  The Docker daemon can listen for [Docker Remote API](../api/docker_remote_api.md)
    81  requests via three different types of Socket: `unix`, `tcp`, and `fd`.
    82  
    83  By default, a `unix` domain socket (or IPC socket) is created at
    84  `/var/run/docker.sock`, requiring either `root` permission, or `docker` group
    85  membership.
    86  
    87  If you need to access the Docker daemon remotely, you need to enable the `tcp`
    88  Socket. Beware that the default setup provides un-encrypted and
    89  un-authenticated direct access to the Docker daemon - and should be secured
    90  either using the [built in HTTPS encrypted socket](../../security/https/), or by
    91  putting a secure web proxy in front of it. You can listen on port `2375` on all
    92  network interfaces with `-H tcp://0.0.0.0:2375`, or on a particular network
    93  interface using its IP address: `-H tcp://192.168.59.103:2375`. It is
    94  conventional to use port `2375` for un-encrypted, and port `2376` for encrypted
    95  communication with the daemon.
    96  
    97  > **Note:**
    98  > If you're using an HTTPS encrypted socket, keep in mind that only
    99  > TLS1.0 and greater are supported. Protocols SSLv3 and under are not
   100  > supported anymore for security reasons.
   101  
   102  On Systemd based systems, you can communicate with the daemon via
   103  [Systemd socket activation](http://0pointer.de/blog/projects/socket-activation.html),
   104  use `docker daemon -H fd://`. Using `fd://` will work perfectly for most setups but
   105  you can also specify individual sockets: `docker daemon -H fd://3`. If the
   106  specified socket activated files aren't found, then Docker will exit. You can
   107  find examples of using Systemd socket activation with Docker and Systemd in the
   108  [Docker source tree](https://github.com/docker/docker/tree/master/contrib/init/systemd/).
   109  
   110  You can configure the Docker daemon to listen to multiple sockets at the same
   111  time using multiple `-H` options:
   112  
   113      # listen using the default unix socket, and on 2 specific IP addresses on this host.
   114      docker daemon -H unix:///var/run/docker.sock -H tcp://192.168.59.106 -H tcp://10.10.10.2
   115  
   116  The Docker client will honor the `DOCKER_HOST` environment variable to set the
   117  `-H` flag for the client.
   118  
   119      $ docker -H tcp://0.0.0.0:2375 ps
   120      # or
   121      $ export DOCKER_HOST="tcp://0.0.0.0:2375"
   122      $ docker ps
   123      # both are equal
   124  
   125  Setting the `DOCKER_TLS_VERIFY` environment variable to any value other than
   126  the empty string is equivalent to setting the `--tlsverify` flag. The following
   127  are equivalent:
   128  
   129      $ docker --tlsverify ps
   130      # or
   131      $ export DOCKER_TLS_VERIFY=1
   132      $ docker ps
   133  
   134  The Docker client will honor the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
   135  environment variables (or the lowercase versions thereof). `HTTPS_PROXY` takes
   136  precedence over `HTTP_PROXY`.
   137  
   138  ### Daemon storage-driver option
   139  
   140  The Docker daemon has support for several different image layer storage
   141  drivers: `aufs`, `devicemapper`, `btrfs`, `zfs` and `overlay`.
   142  
   143  The `aufs` driver is the oldest, but is based on a Linux kernel patch-set that
   144  is unlikely to be merged into the main kernel. These are also known to cause
   145  some serious kernel crashes. However, `aufs` is also the only storage driver
   146  that allows containers to share executable and shared library memory, so is a
   147  useful choice when running thousands of containers with the same program or
   148  libraries.
   149  
   150  The `devicemapper` driver uses thin provisioning and Copy on Write (CoW)
   151  snapshots. For each devicemapper graph location – typically
   152  `/var/lib/docker/devicemapper` – a thin pool is created based on two block
   153  devices, one for data and one for metadata. By default, these block devices
   154  are created automatically by using loopback mounts of automatically created
   155  sparse files. Refer to [Storage driver options](#storage-driver-options) below
   156  for a way how to customize this setup.
   157  [~jpetazzo/Resizing Docker containers with the Device Mapper plugin](http://jpetazzo.github.io/2014/01/29/docker-device-mapper-resize/)
   158  article explains how to tune your existing setup without the use of options.
   159  
   160  The `btrfs` driver is very fast for `docker build` - but like `devicemapper`
   161  does not share executable memory between devices. Use
   162  `docker daemon -s btrfs -g /mnt/btrfs_partition`.
   163  
   164  The `zfs` driver is probably not as fast as `btrfs` but has a longer track record
   165  on stability. Thanks to `Single Copy ARC` shared blocks between clones will be
   166  cached only once. Use `docker daemon -s zfs`. To select a different zfs filesystem
   167  set `zfs.fsname` option as described in [Storage driver options](#storage-driver-options).
   168  
   169  The `overlay` is a very fast union filesystem. It is now merged in the main
   170  Linux kernel as of [3.18.0](https://lkml.org/lkml/2014/10/26/137). Call
   171  `docker daemon -s overlay` to use it.
   172  
   173  > **Note:**
   174  > As promising as `overlay` is, the feature is still quite young and should not
   175  > be used in production. Most notably, using `overlay` can cause excessive
   176  > inode consumption (especially as the number of images grows), as well as
   177  > being incompatible with the use of RPMs.
   178  
   179  > **Note:**
   180  > It is currently unsupported on `btrfs` or any Copy on Write filesystem
   181  > and should only be used over `ext4` partitions.
   182  
   183  ### Storage driver options
   184  
   185  Particular storage-driver can be configured with options specified with
   186  `--storage-opt` flags. Options for `devicemapper` are prefixed with `dm` and
   187  options for `zfs` start with `zfs`.
   188  
   189  *  `dm.thinpooldev`
   190  
   191       Specifies a custom block storage device to use for the thin pool.
   192  
   193       If using a block device for device mapper storage, it is best to use `lvm`
   194       to create and manage the thin-pool volume. This volume is then handed to Docker
   195       to exclusively create snapshot volumes needed for images and containers.
   196  
   197       Managing the thin-pool outside of Docker makes for the most feature-rich
   198       method of having Docker utilize device mapper thin provisioning as the
   199       backing storage for Docker's containers. The highlights of the lvm-based
   200       thin-pool management feature include: automatic or interactive thin-pool
   201       resize support, dynamically changing thin-pool features, automatic thinp
   202       metadata checking when lvm activates the thin-pool, etc.
   203  
   204       As a fallback if no thin pool is provided, loopback files will be
   205       created. Loopback is very slow, but can be used without any
   206       pre-configuration of storage. It is strongly recommended that you do
   207       not use loopback in production. Ensure your Docker daemon has a
   208       `--storage-opt dm.thinpooldev` argument provided.
   209  
   210       Example use:
   211  
   212          $ docker daemon \
   213                --storage-opt dm.thinpooldev=/dev/mapper/thin-pool
   214  
   215  *  `dm.basesize`
   216  
   217      Specifies the size to use when creating the base device, which limits the
   218      size of images and containers. The default value is 10G. Note, thin devices
   219      are inherently "sparse", so a 10G device which is mostly empty doesn't use
   220      10 GB of space on the pool. However, the filesystem will use more space for
   221      the empty case the larger the device is.
   222  
   223      The base device size can be increased at daemon restart which will allow
   224      all future images and containers (based on those new images) to be of the
   225      new base device size.
   226  
   227      Example use:
   228  
   229          $ docker daemon --storage-opt dm.basesize=50G
   230  
   231      This will increase the base device size to 50G. The Docker daemon will throw an
   232      error if existing base device size is larger than 50G. A user can use
   233      this option to expand the base device size however shrinking is not permitted.
   234  
   235      This value affects the system-wide "base" empty filesystem
   236      that may already be initialized and inherited by pulled images. Typically,
   237      a change to this value requires additional steps to take effect:
   238  
   239          $ sudo service docker stop
   240          $ sudo rm -rf /var/lib/docker
   241          $ sudo service docker start
   242  
   243      Example use:
   244  
   245          $ docker daemon --storage-opt dm.basesize=20G
   246  
   247  *  `dm.loopdatasize`
   248  
   249      > **Note**:
   250  	> This option configures devicemapper loopback, which should not
   251  	> be used in production.
   252  
   253      Specifies the size to use when creating the loopback file for the
   254      "data" device which is used for the thin pool. The default size is
   255      100G. The file is sparse, so it will not initially take up this
   256      much space.
   257  
   258      Example use:
   259  
   260          $ docker daemon --storage-opt dm.loopdatasize=200G
   261  
   262  *  `dm.loopmetadatasize`
   263  
   264      > **Note**:
   265      > This option configures devicemapper loopback, which should not
   266      > be used in production.
   267  
   268      Specifies the size to use when creating the loopback file for the
   269      "metadata" device which is used for the thin pool. The default size
   270      is 2G. The file is sparse, so it will not initially take up
   271      this much space.
   272  
   273      Example use:
   274  
   275          $ docker daemon --storage-opt dm.loopmetadatasize=4G
   276  
   277  *  `dm.fs`
   278  
   279      Specifies the filesystem type to use for the base device. The supported
   280      options are "ext4" and "xfs". The default is "xfs"
   281  
   282      Example use:
   283  
   284          $ docker daemon --storage-opt dm.fs=ext4
   285  
   286  *  `dm.mkfsarg`
   287  
   288      Specifies extra mkfs arguments to be used when creating the base device.
   289  
   290      Example use:
   291  
   292          $ docker daemon --storage-opt "dm.mkfsarg=-O ^has_journal"
   293  
   294  *  `dm.mountopt`
   295  
   296      Specifies extra mount options used when mounting the thin devices.
   297  
   298      Example use:
   299  
   300          $ docker daemon --storage-opt dm.mountopt=nodiscard
   301  
   302  *  `dm.datadev`
   303  
   304      (Deprecated, use `dm.thinpooldev`)
   305  
   306      Specifies a custom blockdevice to use for data for the thin pool.
   307  
   308      If using a block device for device mapper storage, ideally both datadev and
   309      metadatadev should be specified to completely avoid using the loopback
   310      device.
   311  
   312      Example use:
   313  
   314          $ docker daemon \
   315                --storage-opt dm.datadev=/dev/sdb1 \
   316                --storage-opt dm.metadatadev=/dev/sdc1
   317  
   318  *  `dm.metadatadev`
   319  
   320      (Deprecated, use `dm.thinpooldev`)
   321  
   322      Specifies a custom blockdevice to use for metadata for the thin pool.
   323  
   324      For best performance the metadata should be on a different spindle than the
   325      data, or even better on an SSD.
   326  
   327      If setting up a new metadata pool it is required to be valid. This can be
   328      achieved by zeroing the first 4k to indicate empty metadata, like this:
   329  
   330          $ dd if=/dev/zero of=$metadata_dev bs=4096 count=1
   331  
   332      Example use:
   333  
   334          $ docker daemon \
   335                --storage-opt dm.datadev=/dev/sdb1 \
   336                --storage-opt dm.metadatadev=/dev/sdc1
   337  
   338  *  `dm.blocksize`
   339  
   340      Specifies a custom blocksize to use for the thin pool. The default
   341      blocksize is 64K.
   342  
   343      Example use:
   344  
   345          $ docker daemon --storage-opt dm.blocksize=512K
   346  
   347  *  `dm.blkdiscard`
   348  
   349      Enables or disables the use of blkdiscard when removing devicemapper
   350      devices. This is enabled by default (only) if using loopback devices and is
   351      required to resparsify the loopback file on image/container removal.
   352  
   353      Disabling this on loopback can lead to *much* faster container removal
   354      times, but will make the space used in `/var/lib/docker` directory not be
   355      returned to the system for other use when containers are removed.
   356  
   357      Example use:
   358  
   359          $ docker daemon --storage-opt dm.blkdiscard=false
   360  
   361  *  `dm.override_udev_sync_check`
   362  
   363      Overrides the `udev` synchronization checks between `devicemapper` and `udev`.
   364      `udev` is the device manager for the Linux kernel.
   365  
   366      To view the `udev` sync support of a Docker daemon that is using the
   367      `devicemapper` driver, run:
   368  
   369          $ docker info
   370          [...]
   371          Udev Sync Supported: true
   372          [...]
   373  
   374      When `udev` sync support is `true`, then `devicemapper` and udev can
   375      coordinate the activation and deactivation of devices for containers.
   376  
   377      When `udev` sync support is `false`, a race condition occurs between
   378      the`devicemapper` and `udev` during create and cleanup. The race condition
   379      results in errors and failures. (For information on these failures, see
   380      [docker#4036](https://github.com/docker/docker/issues/4036))
   381  
   382      To allow the `docker` daemon to start, regardless of `udev` sync not being
   383      supported, set `dm.override_udev_sync_check` to true:
   384  
   385          $ docker daemon --storage-opt dm.override_udev_sync_check=true
   386  
   387      When this value is `true`, the  `devicemapper` continues and simply warns
   388      you the errors are happening.
   389  
   390      > **Note:**
   391      > The ideal is to pursue a `docker` daemon and environment that does
   392      > support synchronizing with `udev`. For further discussion on this
   393      > topic, see [docker#4036](https://github.com/docker/docker/issues/4036).
   394      > Otherwise, set this flag for migrating existing Docker daemons to
   395      > a daemon with a supported environment.
   396  
   397  *  `dm.use_deferred_removal`
   398  
   399      Enables use of deferred device removal if `libdm` and the kernel driver
   400      support the mechanism.
   401  
   402      Deferred device removal means that if device is busy when devices are
   403      being removed/deactivated, then a deferred removal is scheduled on
   404      device. And devices automatically go away when last user of the device
   405      exits.
   406  
   407      For example, when a container exits, its associated thin device is removed.
   408      If that device has leaked into some other mount namespace and can't be
   409      removed, the container exit still succeeds and this option causes the
   410      system to schedule the device for deferred removal. It does not wait in a
   411      loop trying to remove a busy device.
   412  
   413      Example use:
   414  
   415          $ docker daemon --storage-opt dm.use_deferred_removal=true
   416  
   417  *  `dm.use_deferred_deletion`
   418  
   419      Enables use of deferred device deletion for thin pool devices. By default,
   420      thin pool device deletion is synchronous. Before a container is deleted,
   421      the Docker daemon removes any associated devices. If the storage driver
   422      can not remove a device, the container deletion fails and daemon returns.
   423  
   424          Error deleting container: Error response from daemon: Cannot destroy container
   425  
   426      To avoid this failure, enable both deferred device deletion and deferred
   427      device removal on the daemon.
   428  
   429          $ docker daemon \
   430                --storage-opt dm.use_deferred_deletion=true \
   431                --storage-opt dm.use_deferred_removal=true
   432  
   433      With these two options enabled, if a device is busy when the driver is
   434      deleting a container, the driver marks the device as deleted. Later, when
   435      the device isn't in use, the driver deletes it.
   436  
   437      In general it should be safe to enable this option by default. It will help
   438      when unintentional leaking of mount point happens across multiple mount
   439      namespaces.
   440  
   441  Currently supported options of `zfs`:
   442  
   443  * `zfs.fsname`
   444  
   445      Set zfs filesystem under which docker will create its own datasets.
   446      By default docker will pick up the zfs filesystem where docker graph
   447      (`/var/lib/docker`) is located.
   448  
   449      Example use:
   450  
   451          $ docker daemon -s zfs --storage-opt zfs.fsname=zroot/docker
   452  
   453  ## Docker execdriver option
   454  
   455  The Docker daemon uses a specifically built `libcontainer` execution driver as
   456  its interface to the Linux kernel `namespaces`, `cgroups`, and `SELinux`.
   457  
   458  ## Options for the native execdriver
   459  
   460  You can configure the `native` (libcontainer) execdriver using options specified
   461  with the `--exec-opt` flag. All the flag's options have the `native` prefix. A
   462  single `native.cgroupdriver` option is available.
   463  
   464  The `native.cgroupdriver` option specifies the management of the container's
   465  cgroups. You can specify `cgroupfs` or `systemd`. If you specify `systemd` and
   466  it is not available, the system uses `cgroupfs`. If you omit the
   467  `native.cgroupdriver` option,` cgroupfs` is used.
   468  This example sets the `cgroupdriver` to `systemd`:
   469  
   470      $ sudo docker daemon --exec-opt native.cgroupdriver=systemd
   471  
   472  Setting this option applies to all containers the daemon launches.
   473  
   474  Also Windows Container makes use of `--exec-opt` for special purpose. Docker user
   475  can specify default container isolation technology with this, for example:
   476  
   477      $ docker daemon --exec-opt isolation=hyperv
   478  
   479  Will make `hyperv` the default isolation technology on Windows, without specifying
   480  isolation value on daemon start, Windows isolation technology will default to `process`.
   481  
   482  ## Daemon DNS options
   483  
   484  To set the DNS server for all Docker containers, use
   485  `docker daemon --dns 8.8.8.8`.
   486  
   487  To set the DNS search domain for all Docker containers, use
   488  `docker daemon --dns-search example.com`.
   489  
   490  ## Insecure registries
   491  
   492  Docker considers a private registry either secure or insecure. In the rest of
   493  this section, *registry* is used for *private registry*, and `myregistry:5000`
   494  is a placeholder example for a private registry.
   495  
   496  A secure registry uses TLS and a copy of its CA certificate is placed on the
   497  Docker host at `/etc/docker/certs.d/myregistry:5000/ca.crt`. An insecure
   498  registry is either not using TLS (i.e., listening on plain text HTTP), or is
   499  using TLS with a CA certificate not known by the Docker daemon. The latter can
   500  happen when the certificate was not found under
   501  `/etc/docker/certs.d/myregistry:5000/`, or if the certificate verification
   502  failed (i.e., wrong CA).
   503  
   504  By default, Docker assumes all, but local (see local registries below),
   505  registries are secure. Communicating with an insecure registry is not possible
   506  if Docker assumes that registry is secure. In order to communicate with an
   507  insecure registry, the Docker daemon requires `--insecure-registry` in one of
   508  the following two forms:
   509  
   510  * `--insecure-registry myregistry:5000` tells the Docker daemon that
   511    myregistry:5000 should be considered insecure.
   512  * `--insecure-registry 10.1.0.0/16` tells the Docker daemon that all registries
   513    whose domain resolve to an IP address is part of the subnet described by the
   514    CIDR syntax, should be considered insecure.
   515  
   516  The flag can be used multiple times to allow multiple registries to be marked
   517  as insecure.
   518  
   519  If an insecure registry is not marked as insecure, `docker pull`,
   520  `docker push`, and `docker search` will result in an error message prompting
   521  the user to either secure or pass the `--insecure-registry` flag to the Docker
   522  daemon as described above.
   523  
   524  Local registries, whose IP address falls in the 127.0.0.0/8 range, are
   525  automatically marked as insecure as of Docker 1.3.2. It is not recommended to
   526  rely on this, as it may change in the future.
   527  
   528  Enabling `--insecure-registry`, i.e., allowing un-encrypted and/or untrusted
   529  communication, can be useful when running a local registry.  However,
   530  because its use creates security vulnerabilities it should ONLY be enabled for
   531  testing purposes.  For increased security, users should add their CA to their
   532  system's list of trusted CAs instead of enabling `--insecure-registry`.
   533  
   534  ## Legacy Registries
   535  
   536  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.
   537  
   538  ## Running a Docker daemon behind a HTTPS_PROXY
   539  
   540  When running inside a LAN that uses a `HTTPS` proxy, the Docker Hub
   541  certificates will be replaced by the proxy's certificates. These certificates
   542  need to be added to your Docker host's configuration:
   543  
   544  1. Install the `ca-certificates` package for your distribution
   545  2. Ask your network admin for the proxy's CA certificate and append them to
   546     `/etc/pki/tls/certs/ca-bundle.crt`
   547  3. Then start your Docker daemon with `HTTPS_PROXY=http://username:password@proxy:port/ docker daemon`.
   548     The `username:` and `password@` are optional - and are only needed if your
   549     proxy is set up to require authentication.
   550  
   551  This will only add the proxy and authentication to the Docker daemon's requests -
   552  your `docker build`s and running containers will need extra configuration to
   553  use the proxy
   554  
   555  ## Default Ulimits
   556  
   557  `--default-ulimit` allows you to set the default `ulimit` options to use for
   558  all containers. It takes the same options as `--ulimit` for `docker run`. If
   559  these defaults are not set, `ulimit` settings will be inherited, if not set on
   560  `docker run`, from the Docker daemon. Any `--ulimit` options passed to
   561  `docker run` will overwrite these defaults.
   562  
   563  Be careful setting `nproc` with the `ulimit` flag as `nproc` is designed by Linux to
   564  set the maximum number of processes available to a user, not to a container. For details
   565  please check the [run](run.md) reference.
   566  
   567  ## Nodes discovery
   568  
   569  The `--cluster-advertise` option specifies the `host:port` or `interface:port`
   570  combination that this particular daemon instance should use when advertising
   571  itself to the cluster. The daemon is reached by remote hosts through this value.
   572  If you  specify an interface, make sure it includes the IP address of the actual
   573  Docker host. For Engine installation created through `docker-machine`, the
   574  interface is typically `eth1`.
   575  
   576  The daemon uses [libkv](https://github.com/docker/libkv/) to advertise
   577  the node within the cluster. Some key-value backends support mutual
   578  TLS. To configure the client TLS settings used by the daemon can be configured
   579  using the `--cluster-store-opt` flag, specifying the paths to PEM encoded
   580  files. For example:
   581  
   582  ```bash
   583  docker daemon \
   584      --cluster-advertise 192.168.1.2:2376 \
   585      --cluster-store etcd://192.168.1.2:2379 \
   586      --cluster-store-opt kv.cacertfile=/path/to/ca.pem \
   587      --cluster-store-opt kv.certfile=/path/to/cert.pem \
   588      --cluster-store-opt kv.keyfile=/path/to/key.pem
   589  ```
   590  
   591  The currently supported cluster store options are:
   592  
   593  *  `discovery.heartbeat`
   594  
   595      Specifies the heartbeat timer in seconds which is used by the daemon as a
   596      keepalive mechanism to make sure discovery module treats the node as alive
   597      in the cluster. If not configured, the default value is 20 seconds.
   598  
   599  *  `discovery.ttl`
   600  
   601      Specifies the ttl (time-to-live) in seconds which is used by the discovery
   602      module to timeout a node if a valid heartbeat is not received within the
   603      configured ttl value. If not configured, the default value is 60 seconds.
   604  
   605  *  `kv.cacertfile`
   606  
   607      Specifies the path to a local file with PEM encoded CA certificates to trust
   608  
   609  *  `kv.certfile`
   610  
   611      Specifies the path to a local file with a PEM encoded certificate.  This
   612      certificate is used as the client cert for communication with the
   613      Key/Value store.
   614  
   615  *  `kv.keyfile`
   616  
   617      Specifies the path to a local file with a PEM encoded private key.  This
   618      private key is used as the client key for communication with the
   619      Key/Value store.
   620  
   621  *  `kv.path`
   622  
   623      Specifies the path in the Key/Value store. If not configured, the default value is 'docker/nodes'.
   624  
   625  ## Access authorization
   626  
   627  Docker's access authorization can be extended by authorization plugins that your
   628  organization can purchase or build themselves. You can install one or more
   629  authorization plugins when you start the Docker `daemon` using the
   630  `--authorization-plugin=PLUGIN_ID` option.
   631  
   632  ```bash
   633  docker daemon --authorization-plugin=plugin1 --authorization-plugin=plugin2,...
   634  ```
   635  
   636  The `PLUGIN_ID` value is either the plugin's name or a path to its specification
   637  file. The plugin's implementation determines whether you can specify a name or
   638  path. Consult with your Docker administrator to get information about the
   639  plugins available to you.
   640  
   641  Once a plugin is installed, requests made to the `daemon` through the command
   642  line or Docker's remote API are allowed or denied by the plugin.  If you have
   643  multiple plugins installed, at least one must allow the request for it to
   644  complete.
   645  
   646  For information about how to create an authorization plugin, see [authorization
   647  plugin](../../extend/plugins_authorization.md) section in the Docker extend section of this documentation.
   648  
   649  
   650  ## Daemon user namespace options
   651  
   652  The Linux kernel [user namespace support](http://man7.org/linux/man-pages/man7/user_namespaces.7.html) provides additional security by enabling
   653  a process, and therefore a container, to have a unique range of user and
   654  group IDs which are outside the traditional user and group range utilized by
   655  the host system. Potentially the most important security improvement is that,
   656  by default, container processes running as the `root` user will have expected
   657  administrative privilege (with some restrictions) inside the container but will
   658  effectively be mapped to an unprivileged `uid` on the host.
   659  
   660  When user namespace support is enabled, Docker creates a single daemon-wide mapping
   661  for all containers running on the same engine instance. The mappings will
   662  utilize the existing subordinate user and group ID feature available on all modern
   663  Linux distributions.
   664  The [`/etc/subuid`](http://man7.org/linux/man-pages/man5/subuid.5.html) and
   665  [`/etc/subgid`](http://man7.org/linux/man-pages/man5/subgid.5.html) files will be
   666  read for the user, and optional group, specified to the `--userns-remap`
   667  parameter.  If you do not wish to specify your own user and/or group, you can
   668  provide `default` as the value to this flag, and a user will be created on your behalf
   669  and provided subordinate uid and gid ranges. This default user will be named
   670  `dockremap`, and entries will be created for it in `/etc/passwd` and
   671  `/etc/group` using your distro's standard user and group creation tools.
   672  
   673  > **Note**: The single mapping per-daemon restriction is in place for now
   674  > because Docker shares image layers from its local cache across all
   675  > containers running on the engine instance.  Since file ownership must be
   676  > the same for all containers sharing the same layer content, the decision
   677  > was made to map the file ownership on `docker pull` to the daemon's user and
   678  > group mappings so that there is no delay for running containers once the
   679  > content is downloaded. This design preserves the same performance for `docker
   680  > pull`, `docker push`, and container startup as users expect with
   681  > user namespaces disabled.
   682  
   683  ### Starting the daemon with user namespaces enabled
   684  
   685  To enable user namespace support, start the daemon with the
   686  `--userns-remap` flag, which accepts values in the following formats:
   687  
   688   - uid
   689   - uid:gid
   690   - username
   691   - username:groupname
   692  
   693  If numeric IDs are provided, translation back to valid user or group names
   694  will occur so that the subordinate uid and gid information can be read, given
   695  these resources are name-based, not id-based.  If the numeric ID information
   696  provided does not exist as entries in `/etc/passwd` or `/etc/group`, daemon
   697  startup will fail with an error message.
   698  
   699  > **Note:** On Fedora 22, you have to `touch` the `/etc/subuid` and `/etc/subgid`
   700  > files to have ranges assigned when users are created.  This must be done
   701  > *before* the `--userns-remap` option is enabled. Once these files exist, the
   702  > daemon can be (re)started and range assignment on user creation works properly.
   703  
   704  *Example: starting with default Docker user management:*
   705  
   706  ```bash
   707  $ docker daemon --userns-remap=default
   708  ```
   709  
   710  When `default` is provided, Docker will create - or find the existing - user and group
   711  named `dockremap`. If the user is created, and the Linux distribution has
   712  appropriate support, the `/etc/subuid` and `/etc/subgid` files will be populated
   713  with a contiguous 65536 length range of subordinate user and group IDs, starting
   714  at an offset based on prior entries in those files.  For example, Ubuntu will
   715  create the following range, based on an existing user named `user1` already owning
   716  the first 65536 range:
   717  
   718  ```bash
   719  $ cat /etc/subuid
   720  user1:100000:65536
   721  dockremap:165536:65536
   722  ```
   723  
   724  If you have a preferred/self-managed user with subordinate ID mappings already
   725  configured, you can provide that username or uid to the `--userns-remap` flag.
   726  If you have a group that doesn't match the username, you may provide the `gid`
   727  or group name as well; otherwise the username will be used as the group name
   728  when querying the system for the subordinate group ID range.
   729  
   730  ### Detailed information on `subuid`/`subgid` ranges
   731  
   732  Given potential advanced use of the subordinate ID ranges by power users, the
   733  following paragraphs define how the Docker daemon currently uses the range entries
   734  found within the subordinate range files.
   735  
   736  The simplest case is that only one contiguous range is defined for the
   737  provided user or group. In this case, Docker will use that entire contiguous
   738  range for the mapping of host uids and gids to the container process.  This
   739  means that the first ID in the range will be the remapped root user, and the
   740  IDs above that initial ID will map host ID 1 through the end of the range.
   741  
   742  From the example `/etc/subuid` content shown above, the remapped root
   743  user would be uid 165536.
   744  
   745  If the system administrator has set up multiple ranges for a single user or
   746  group, the Docker daemon will read all the available ranges and use the
   747  following algorithm to create the mapping ranges:
   748  
   749  1. The range segments found for the particular user will be sorted by *start ID* ascending.
   750  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.
   751  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`.
   752  
   753  ### User namespace known restrictions
   754  
   755  The following standard Docker features are currently incompatible when
   756  running a Docker daemon with user namespaces enabled:
   757  
   758   - sharing PID or NET namespaces with the host (`--pid=host` or `--net=host`)
   759   - sharing a network namespace with an existing container (`--net=container:*other*`)
   760   - sharing an IPC namespace with an existing container (`--ipc=container:*other*`)
   761   - A `--readonly` container filesystem (this is a Linux kernel restriction against remounting with modified flags of a currently mounted filesystem when inside a user namespace)
   762   - external (volume or graph) drivers which are unaware/incapable of using daemon user mappings
   763   - Using `--privileged` mode flag on `docker run`
   764  
   765  In general, user namespaces are an advanced feature and will require
   766  coordination with other capabilities. For example, if volumes are mounted from
   767  the host, file ownership will have to be pre-arranged if the user or
   768  administrator wishes the containers to have expected access to the volume
   769  contents.
   770  
   771  Finally, while the `root` user inside a user namespaced container process has
   772  many of the expected admin privileges that go along with being the superuser, the
   773  Linux kernel has restrictions based on internal knowledge that this is a user namespaced
   774  process. The most notable restriction that we are aware of at this time is the
   775  inability to use `mknod`. Permission will be denied for device creation even as
   776  container `root` inside a user namespace.
   777  
   778  ## Miscellaneous options
   779  
   780  IP masquerading uses address translation to allow containers without a public
   781  IP to talk to other machines on the Internet. This may interfere with some
   782  network topologies and can be disabled with `--ip-masq=false`.
   783  
   784  Docker supports softlinks for the Docker data directory (`/var/lib/docker`) and
   785  for `/var/lib/docker/tmp`. The `DOCKER_TMPDIR` and the data directory can be
   786  set like this:
   787  
   788      DOCKER_TMPDIR=/mnt/disk2/tmp /usr/local/bin/docker daemon -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1
   789      # or
   790      export DOCKER_TMPDIR=/mnt/disk2/tmp
   791      /usr/local/bin/docker daemon -D -g /var/lib/docker -H unix:// > /var/lib/docker-machine/docker.log 2>&1
   792  
   793  
   794  ## Default cgroup parent
   795  
   796  The `--cgroup-parent` option allows you to set the default cgroup parent
   797  to use for containers. If this option is not set, it defaults to `/docker` for
   798  fs cgroup driver and `system.slice` for systemd cgroup driver.
   799  
   800  If the cgroup has a leading forward slash (`/`), the cgroup is created
   801  under the root cgroup, otherwise the cgroup is created under the daemon
   802  cgroup.
   803  
   804  Assuming the daemon is running in cgroup `daemoncgroup`,
   805  `--cgroup-parent=/foobar` creates a cgroup in
   806  `/sys/fs/cgroup/memory/foobar`, whereas using `--cgroup-parent=foobar`
   807  creates the cgroup in `/sys/fs/cgroup/memory/daemoncgroup/foobar`
   808  
   809  The systemd cgroup driver has different rules for `--cgroup-parent`. Systemd
   810  represents hierarchy by slice and the name of the slice encodes the location in
   811  the tree. So `--cgroup-parent` for systemd cgroups should be a slice name. A
   812  name can consist of a dash-separated series of names, which describes the path
   813  to the slice from the root slice. For example, `--cgroup-parent=user-a-b.slice`
   814  means the memory cgroup for the container is created in
   815  `/sys/fs/cgroup/memory/user.slice/user-a.slice/user-a-b.slice/docker-<id>.scope`.
   816  
   817  This setting can also be set per container, using the `--cgroup-parent`
   818  option on `docker create` and `docker run`, and takes precedence over
   819  the `--cgroup-parent` option on the daemon.
   820  
   821  ## Daemon configuration file
   822  
   823  The `--config-file` option allows you to set any configuration option
   824  for the daemon in a JSON format. This file uses the same flag names as keys,
   825  except for flags that allow several entries, where it uses the plural
   826  of the flag name, e.g., `labels` for the `label` flag. By default,
   827  docker tries to load a configuration file from `/etc/docker/daemon.json`
   828  on Linux and `%programdata%\docker\config\daemon.json` on Windows.
   829  
   830  The options set in the configuration file must not conflict with options set
   831  via flags. The docker daemon fails to start if an option is duplicated between
   832  the file and the flags, regardless their value. We do this to avoid
   833  silently ignore changes introduced in configuration reloads.
   834  For example, the daemon fails to start if you set daemon labels
   835  in the configuration file and also set daemon labels via the `--label` flag.
   836  
   837  Options that are not present in the file are ignored when the daemon starts.
   838  This is a full example of the allowed configuration options in the file:
   839  
   840  ```json
   841  {
   842  	"authorization-plugins": [],
   843  	"dns": [],
   844  	"dns-opts": [],
   845  	"dns-search": [],
   846  	"exec-opts": [],
   847  	"exec-root": "",
   848  	"storage-driver": "",
   849  	"storage-opts": "",
   850  	"labels": [],
   851  	"log-driver": "",
   852  	"log-opts": [],
   853  	"mtu": 0,
   854  	"pidfile": "",
   855  	"graph": "",
   856  	"cluster-store": "",
   857  	"cluster-store-opts": [],
   858  	"cluster-advertise": "",
   859  	"debug": true,
   860  	"hosts": [],
   861  	"log-level": "",
   862  	"tls": true,
   863  	"tlsverify": true,
   864  	"tlscacert": "",
   865  	"tlscert": "",
   866  	"tlskey": "",
   867  	"api-cors-headers": "",
   868  	"selinux-enabled": false,
   869  	"userns-remap": "",
   870  	"group": "",
   871  	"cgroup-parent": "",
   872  	"default-ulimits": {},
   873  	"ipv6": false,
   874  	"iptables": false,
   875  	"ip-forward": false,
   876  	"ip-mask": false,
   877  	"userland-proxy": false,
   878  	"ip": "0.0.0.0",
   879  	"bridge": "",
   880  	"bip": "",
   881  	"fixed-cidr": "",
   882  	"fixed-cidr-v6": "",
   883  	"default-gateway": "",
   884  	"default-gateway-v6": "",
   885  	"icc": false,
   886  	"raw-logs": false,
   887  	"registry-mirrors": [],
   888  	"insecure-registries": [],
   889  	"disable-legacy-registry": false
   890  }
   891  ```
   892  
   893  ### Configuration reloading
   894  
   895  Some options can be reconfigured when the daemon is running without requiring
   896  to restart the process. We use the `SIGHUP` signal in Linux to reload, and a global event
   897  in Windows with the key `Global\docker-daemon-config-$PID`. The options can
   898  be modified in the configuration file but still will check for conflicts with
   899  the provided flags. The daemon fails to reconfigure itself
   900  if there are conflicts, but it won't stop execution.
   901  
   902  The list of currently supported options that can be reconfigured is this:
   903  
   904  - `debug`: it changes the daemon to debug mode when set to true.
   905  - `cluster-store`: it reloads the discovery store with the new address.
   906  - `cluster-store-opts`: it uses the new options to reload the discovery store.
   907  - `cluster-advertise`: it modifies the address advertised after reloading.
   908  - `labels`: it replaces the daemon labels with a new set of labels.
   909  
   910  Updating and reloading the cluster configurations such as `--cluster-store`,
   911  `--cluster-advertise` and `--cluster-store-opts` will take effect only if
   912  these configurations were not previously configured. If `--cluster-store`
   913  has been provided in flags and `cluster-advertise` not, `cluster-advertise`
   914  can be added in the configuration file without accompanied by `--cluster-store`
   915  Configuration reload will log a warning message if it detects a change in
   916  previously configured cluster configurations.