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