github.com/akerouanton/docker@v1.11.0-rc3/man/docker-daemon.8.md (about)

     1  % DOCKER(8) Docker User Manuals
     2  % Shishir Mahajan
     3  % SEPTEMBER 2015
     4  # NAME
     5  docker-daemon - Enable daemon mode
     6  
     7  # SYNOPSIS
     8  **docker daemon**
     9  [**--api-cors-header**=[=*API-CORS-HEADER*]]
    10  [**--authorization-plugin**[=*[]*]]
    11  [**-b**|**--bridge**[=*BRIDGE*]]
    12  [**--bip**[=*BIP*]]
    13  [**--cgroup-parent**[=*[]*]]
    14  [**--cluster-store**[=*[]*]]
    15  [**--cluster-advertise**[=*[]*]]
    16  [**--cluster-store-opt**[=*map[]*]]
    17  [**--config-file**[=*/etc/docker/daemon.json*]]
    18  [**--containerd**[=*SOCKET-PATH*]]
    19  [**-D**|**--debug**]
    20  [**--default-gateway**[=*DEFAULT-GATEWAY*]]
    21  [**--default-gateway-v6**[=*DEFAULT-GATEWAY-V6*]]
    22  [**--default-ulimit**[=*[]*]]
    23  [**--disable-legacy-registry**]
    24  [**--dns**[=*[]*]]
    25  [**--dns-opt**[=*[]*]]
    26  [**--dns-search**[=*[]*]]
    27  [**--exec-opt**[=*[]*]]
    28  [**--exec-root**[=*/var/run/docker*]]
    29  [**--fixed-cidr**[=*FIXED-CIDR*]]
    30  [**--fixed-cidr-v6**[=*FIXED-CIDR-V6*]]
    31  [**-G**|**--group**[=*docker*]]
    32  [**-g**|**--graph**[=*/var/lib/docker*]]
    33  [**-H**|**--host**[=*[]*]]
    34  [**--help**]
    35  [**--icc**[=*true*]]
    36  [**--insecure-registry**[=*[]*]]
    37  [**--ip**[=*0.0.0.0*]]
    38  [**--ip-forward**[=*true*]]
    39  [**--ip-masq**[=*true*]]
    40  [**--iptables**[=*true*]]
    41  [**--ipv6**]
    42  [**-l**|**--log-level**[=*info*]]
    43  [**--label**[=*[]*]]
    44  [**--log-driver**[=*json-file*]]
    45  [**--log-opt**[=*map[]*]]
    46  [**--mtu**[=*0*]]
    47  [**-p**|**--pidfile**[=*/var/run/docker.pid*]]
    48  [**--raw-logs**]
    49  [**--registry-mirror**[=*[]*]]
    50  [**-s**|**--storage-driver**[=*STORAGE-DRIVER*]]
    51  [**--selinux-enabled**]
    52  [**--storage-opt**[=*[]*]]
    53  [**--tls**]
    54  [**--tlscacert**[=*~/.docker/ca.pem*]]
    55  [**--tlscert**[=*~/.docker/cert.pem*]]
    56  [**--tlskey**[=*~/.docker/key.pem*]]
    57  [**--tlsverify**]
    58  [**--userland-proxy**[=*true*]]
    59  [**--userns-remap**[=*default*]]
    60  
    61  # DESCRIPTION
    62  **docker** has two distinct functions. It is used for starting the Docker
    63  daemon and to run the CLI (i.e., to command the daemon to manage images,
    64  containers etc.) So **docker** is both a server, as a daemon, and a client
    65  to the daemon, through the CLI.
    66  
    67  To run the Docker daemon you can specify **docker daemon**.
    68  You can check the daemon options using **docker daemon --help**.
    69  Daemon options should be specified after the **daemon** keyword in the following
    70  format.
    71  
    72  **docker daemon [OPTIONS]**
    73  
    74  # OPTIONS
    75  
    76  **--api-cors-header**=""
    77    Set CORS headers in the remote API. Default is cors disabled. Give urls like "http://foo, http://bar, ...". Give "*" to allow all.
    78  
    79  **--authorization-plugin**=""
    80    Set authorization plugins to load
    81  
    82  **-b**, **--bridge**=""
    83    Attach containers to a pre\-existing network bridge; use 'none' to disable container networking
    84  
    85  **--bip**=""
    86    Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b
    87  
    88  **--cgroup-parent**=""
    89    Set parent cgroup for all containers. Default is "/docker" for fs cgroup driver and "system.slice" for systemd cgroup driver.
    90  
    91  **--cluster-store**=""
    92    URL of the distributed storage backend
    93  
    94  **--cluster-advertise**=""
    95    Specifies the 'host:port' or `interface:port` combination that this particular
    96    daemon instance should use when advertising itself to the cluster. The daemon
    97    is reached through this value.
    98  
    99  **--cluster-store-opt**=""
   100    Specifies options for the Key/Value store.
   101  
   102  **--config-file**="/etc/docker/daemon.json"
   103    Specifies the JSON file path to load the configuration from.
   104  
   105  **--containerd**=""
   106    Path to containerd socket.
   107  
   108  **-D**, **--debug**=*true*|*false*
   109    Enable debug mode. Default is false.
   110  
   111  **--default-gateway**=""
   112    IPv4 address of the container default gateway; this address must be part of the bridge subnet (which is defined by \-b or \--bip)
   113  
   114  **--default-gateway-v6**=""
   115    IPv6 address of the container default gateway
   116  
   117  **--default-ulimit**=[]
   118    Set default ulimits for containers.
   119  
   120  **--disable-legacy-registry**=*true*|*false*
   121    Do not contact legacy registries
   122  
   123  **--dns**=""
   124    Force Docker to use specific DNS servers
   125  
   126  **--dns-opt**=""
   127    DNS options to use.
   128  
   129  **--dns-search**=[]
   130    DNS search domains to use.
   131  
   132  **--exec-opt**=[]
   133    Set runtime execution options. See RUNTIME EXECUTION OPTIONS.
   134  
   135  **--exec-root**=""
   136    Path to use as the root of the Docker execution state files. Default is `/var/run/docker`.
   137  
   138  **--fixed-cidr**=""
   139    IPv4 subnet for fixed IPs (e.g., 10.20.0.0/16); this subnet must be nested in the bridge subnet (which is defined by \-b or \-\-bip)
   140  
   141  **--fixed-cidr-v6**=""
   142    IPv6 subnet for global IPv6 addresses (e.g., 2a00:1450::/64)
   143  
   144  **-G**, **--group**=""
   145    Group to assign the unix socket specified by -H when running in daemon mode.
   146    use '' (the empty string) to disable setting of a group. Default is `docker`.
   147  
   148  **-g**, **--graph**=""
   149    Path to use as the root of the Docker runtime. Default is `/var/lib/docker`.
   150  
   151  **-H**, **--host**=[*unix:///var/run/docker.sock*]: tcp://[host:port] to bind or
   152  unix://[/path/to/socket] to use.
   153    The socket(s) to bind to in daemon mode specified using one or more
   154    tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
   155  
   156  **--help**
   157    Print usage statement
   158  
   159  **--icc**=*true*|*false*
   160    Allow unrestricted inter\-container and Docker daemon host communication. If disabled, containers can still be linked together using the **--link** option (see **docker-run(1)**). Default is true.
   161  
   162  **--insecure-registry**=[]
   163    Enable insecure registry communication, i.e., enable un-encrypted and/or untrusted communication.
   164  
   165    List of insecure registries can contain an element with CIDR notation to specify a whole subnet. Insecure registries accept HTTP and/or accept HTTPS with certificates from unknown CAs.
   166  
   167    Enabling `--insecure-registry` is useful when running a local registry.  However, because its use creates security vulnerabilities it should ONLY be enabled for testing purposes.  For increased security, users should add their CA to their system's list of trusted CAs instead of using `--insecure-registry`.
   168  
   169  **--ip**=""
   170    Default IP address to use when binding container ports. Default is `0.0.0.0`.
   171  
   172  **--ip-forward**=*true*|*false*
   173    Enables IP forwarding on the Docker host. The default is `true`. This flag interacts with the IP forwarding setting on your host system's kernel. If your system has IP forwarding disabled, this setting enables it. If your system has IP forwarding enabled, setting this flag to `--ip-forward=false` has no effect.
   174  
   175    This setting will also enable IPv6 forwarding if you have both `--ip-forward=true` and `--fixed-cidr-v6` set. Note that this may reject Router Advertisements and interfere with the host's existing IPv6 configuration. For more information, please consult the documentation about "Advanced Networking - IPv6".
   176  
   177  **--ip-masq**=*true*|*false*
   178    Enable IP masquerading for bridge's IP range. Default is true.
   179  
   180  **--iptables**=*true*|*false*
   181    Enable Docker's addition of iptables rules. Default is true.
   182  
   183  **--ipv6**=*true*|*false*
   184    Enable IPv6 support. Default is false. Docker will create an IPv6-enabled bridge with address fe80::1 which will allow you to create IPv6-enabled containers. Use together with `--fixed-cidr-v6` to provide globally routable IPv6 addresses. IPv6 forwarding will be enabled if not used with `--ip-forward=false`. This may collide with your host's current IPv6 settings. For more information please consult the documentation about "Advanced Networking - IPv6".
   185  
   186  **-l**, **--log-level**="*debug*|*info*|*warn*|*error*|*fatal*"
   187    Set the logging level. Default is `info`.
   188  
   189  **--label**="[]"
   190    Set key=value labels to the daemon (displayed in `docker info`)
   191  
   192  **--log-driver**="*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*awslogs*|*splunk*|*etwlogs*|*gcplogs*|*none*"
   193    Default driver for container logs. Default is `json-file`.
   194    **Warning**: `docker logs` command works only for `json-file` logging driver.
   195  
   196  **--log-opt**=[]
   197    Logging driver specific options.
   198  
   199  **--mtu**=*0*
   200    Set the containers network mtu. Default is `0`.
   201  
   202  **-p**, **--pidfile**=""
   203    Path to use for daemon PID file. Default is `/var/run/docker.pid`
   204  
   205  **--raw-logs**
   206  Output daemon logs in full timestamp format without ANSI coloring. If this flag is not set,
   207  the daemon outputs condensed, colorized logs if a terminal is detected, or full ("raw")
   208  output otherwise.
   209  
   210  **--registry-mirror**=*<scheme>://<host>*
   211    Prepend a registry mirror to be used for image pulls. May be specified multiple times.
   212  
   213  **-s**, **--storage-driver**=""
   214    Force the Docker runtime to use a specific storage driver.
   215  
   216  **--selinux-enabled**=*true*|*false*
   217    Enable selinux support. Default is false. SELinux does not presently support the overlay storage driver.
   218  
   219  **--storage-opt**=[]
   220    Set storage driver options. See STORAGE DRIVER OPTIONS.
   221  
   222  **--tls**=*true*|*false*
   223    Use TLS; implied by --tlsverify. Default is false.
   224  
   225  **--tlscacert**=*~/.docker/ca.pem*
   226    Trust certs signed only by this CA.
   227  
   228  **--tlscert**=*~/.docker/cert.pem*
   229    Path to TLS certificate file.
   230  
   231  **--tlskey**=*~/.docker/key.pem*
   232    Path to TLS key file.
   233  
   234  **--tlsverify**=*true*|*false*
   235    Use TLS and verify the remote (daemon: verify client, client: verify daemon).
   236    Default is false.
   237  
   238  **--userland-proxy**=*true*|*false*
   239      Rely on a userland proxy implementation for inter-container and outside-to-container loopback communications. Default is true.
   240  
   241  **--userns-remap**=*default*|*uid:gid*|*user:group*|*user*|*uid*
   242      Enable user namespaces for containers on the daemon. Specifying "default" will cause a new user and group to be created to handle UID and GID range remapping for the user namespace mappings used for contained processes. Specifying a user (or uid) and optionally a group (or gid) will cause the daemon to lookup the user and group's subordinate ID ranges for use as the user namespace mappings for contained processes.
   243  
   244  # STORAGE DRIVER OPTIONS
   245  
   246  Docker uses storage backends (known as "graphdrivers" in the Docker
   247  internals) to create writable containers from images.  Many of these
   248  backends use operating system level technologies and can be
   249  configured.
   250  
   251  Specify options to the storage backend with **--storage-opt** flags. The
   252  backends that currently take options are *devicemapper* and *zfs*.
   253  Options for *devicemapper* are prefixed with *dm* and options for *zfs*
   254  start with *zfs*.
   255  
   256  Specifically for devicemapper, the default is a "loopback" model which
   257  requires no pre-configuration, but is extremely inefficient.  Do not
   258  use it in production.
   259  
   260  To make the best use of Docker with the devicemapper backend, you must
   261  have a recent version of LVM.  Use `lvm` to create a thin pool; for
   262  more information see `man lvmthin`.  Then, use `--storage-opt
   263  dm.thinpooldev` to tell the Docker engine to use that pool for
   264  allocating images and container snapshots.
   265  
   266  ## Devicemapper options
   267  
   268  #### dm.thinpooldev
   269  
   270  Specifies a custom block storage device to use for the thin pool.
   271  
   272  If using a block device for device mapper storage, it is best to use
   273  `lvm` to create and manage the thin-pool volume. This volume is then
   274  handed to Docker to create snapshot volumes needed for images and
   275  containers.
   276  
   277  Managing the thin-pool outside of Docker makes for the most feature-rich method
   278  of having Docker utilize device mapper thin provisioning as the backing storage
   279  for Docker's containers. The highlights of the LVM-based thin-pool management
   280  feature include: automatic or interactive thin-pool resize support, dynamically
   281  changing thin-pool features, automatic thinp metadata checking when lvm activates
   282  the thin-pool, etc.
   283  
   284  Example use: `docker daemon --storage-opt dm.thinpooldev=/dev/mapper/thin-pool`
   285  
   286  #### dm.basesize
   287  
   288  Specifies the size to use when creating the base device, which limits
   289  the size of images and containers. The default value is 10G. Note,
   290  thin devices are inherently "sparse", so a 10G device which is mostly
   291  empty doesn't use 10 GB of space on the pool. However, the filesystem
   292  will use more space for base images the larger the device
   293  is.
   294  
   295  The base device size can be increased at daemon restart which will allow
   296  all future images and containers (based on those new images) to be of the
   297  new base device size.
   298  
   299  Example use: `docker daemon --storage-opt dm.basesize=50G`
   300  
   301  This will increase the base device size to 50G. The Docker daemon will throw an
   302  error if existing base device size is larger than 50G. A user can use
   303  this option to expand the base device size however shrinking is not permitted.
   304  
   305  This value affects the system-wide "base" empty filesystem that may already
   306  be initialized and inherited by pulled images. Typically, a change to this
   307  value requires additional steps to take effect:
   308  
   309          $ sudo service docker stop
   310          $ sudo rm -rf /var/lib/docker
   311          $ sudo service docker start
   312  
   313  Example use: `docker daemon --storage-opt dm.basesize=20G`
   314  
   315  #### dm.fs
   316  
   317  Specifies the filesystem type to use for the base device. The
   318  supported options are `ext4` and `xfs`. The default is `ext4`.
   319  
   320  Example use: `docker daemon --storage-opt dm.fs=xfs`
   321  
   322  #### dm.mkfsarg
   323  
   324  Specifies extra mkfs arguments to be used when creating the base device.
   325  
   326  Example use: `docker daemon --storage-opt "dm.mkfsarg=-O ^has_journal"`
   327  
   328  #### dm.mountopt
   329  
   330  Specifies extra mount options used when mounting the thin devices.
   331  
   332  Example use: `docker daemon --storage-opt dm.mountopt=nodiscard`
   333  
   334  #### dm.use_deferred_removal
   335  
   336  Enables use of deferred device removal if `libdm` and the kernel driver
   337  support the mechanism.
   338  
   339  Deferred device removal means that if device is busy when devices are
   340  being removed/deactivated, then a deferred removal is scheduled on
   341  device. And devices automatically go away when last user of the device
   342  exits.
   343  
   344  For example, when a container exits, its associated thin device is removed. If
   345  that device has leaked into some other mount namespace and can't be removed,
   346  the container exit still succeeds and this option causes the system to schedule
   347  the device for deferred removal. It does not wait in a loop trying to remove a busy
   348  device.
   349  
   350  Example use: `docker daemon --storage-opt dm.use_deferred_removal=true`
   351  
   352  #### dm.use_deferred_deletion
   353  
   354  Enables use of deferred device deletion for thin pool devices. By default,
   355  thin pool device deletion is synchronous. Before a container is deleted, the
   356  Docker daemon removes any associated devices. If the storage driver can not
   357  remove a device, the container deletion fails and daemon returns.
   358  
   359  `Error deleting container: Error response from daemon: Cannot destroy container`
   360  
   361  To avoid this failure, enable both deferred device deletion and deferred
   362  device removal on the daemon.
   363  
   364  `docker daemon --storage-opt dm.use_deferred_deletion=true --storage-opt dm.use_deferred_removal=true`
   365  
   366  With these two options enabled, if a device is busy when the driver is
   367  deleting a container, the driver marks the device as deleted. Later, when the
   368  device isn't in use, the driver deletes it.
   369  
   370  In general it should be safe to enable this option by default. It will help
   371  when unintentional leaking of mount point happens across multiple mount
   372  namespaces.
   373  
   374  #### dm.loopdatasize
   375  
   376  **Note**: This option configures devicemapper loopback, which should not be used in production.
   377  
   378  Specifies the size to use when creating the loopback file for the
   379  "data" device which is used for the thin pool. The default size is
   380  100G. The file is sparse, so it will not initially take up
   381  this much space.
   382  
   383  Example use: `docker daemon --storage-opt dm.loopdatasize=200G`
   384  
   385  #### dm.loopmetadatasize
   386  
   387  **Note**: This option configures devicemapper loopback, which should not be used in production.
   388  
   389  Specifies the size to use when creating the loopback file for the
   390  "metadata" device which is used for the thin pool. The default size
   391  is 2G. The file is sparse, so it will not initially take up
   392  this much space.
   393  
   394  Example use: `docker daemon --storage-opt dm.loopmetadatasize=4G`
   395  
   396  #### dm.datadev
   397  
   398  (Deprecated, use `dm.thinpooldev`)
   399  
   400  Specifies a custom blockdevice to use for data for a
   401  Docker-managed thin pool.  It is better to use `dm.thinpooldev` - see
   402  the documentation for it above for discussion of the advantages.
   403  
   404  #### dm.metadatadev
   405  
   406  (Deprecated, use `dm.thinpooldev`)
   407  
   408  Specifies a custom blockdevice to use for metadata for a
   409  Docker-managed thin pool.  See `dm.datadev` for why this is
   410  deprecated.
   411  
   412  #### dm.blocksize
   413  
   414  Specifies a custom blocksize to use for the thin pool.  The default
   415  blocksize is 64K.
   416  
   417  Example use: `docker daemon --storage-opt dm.blocksize=512K`
   418  
   419  #### dm.blkdiscard
   420  
   421  Enables or disables the use of `blkdiscard` when removing devicemapper
   422  devices.  This is disabled by default due to the additional latency,
   423  but as a special case with loopback devices it will be enabled, in
   424  order to re-sparsify the loopback file on image/container removal.
   425  
   426  Disabling this on loopback can lead to *much* faster container removal
   427  times, but it also prevents the space used in `/var/lib/docker` directory
   428  from being returned to the system for other use when containers are
   429  removed.
   430  
   431  Example use: `docker daemon --storage-opt dm.blkdiscard=false`
   432  
   433  #### dm.override_udev_sync_check
   434  
   435  By default, the devicemapper backend attempts to synchronize with the
   436  `udev` device manager for the Linux kernel.  This option allows
   437  disabling that synchronization, to continue even though the
   438  configuration may be buggy.
   439  
   440  To view the `udev` sync support of a Docker daemon that is using the
   441  `devicemapper` driver, run:
   442  
   443          $ docker info
   444          [...]
   445           Udev Sync Supported: true
   446          [...]
   447  
   448  When `udev` sync support is `true`, then `devicemapper` and `udev` can
   449  coordinate the activation and deactivation of devices for containers.
   450  
   451  When `udev` sync support is `false`, a race condition occurs between
   452  the `devicemapper` and `udev` during create and cleanup. The race
   453  condition results in errors and failures. (For information on these
   454  failures, see
   455  [docker#4036](https://github.com/docker/docker/issues/4036))
   456  
   457  To allow the `docker` daemon to start, regardless of whether `udev` sync is
   458  `false`, set `dm.override_udev_sync_check` to true:
   459  
   460          $ docker daemon --storage-opt dm.override_udev_sync_check=true
   461  
   462  When this value is `true`, the driver continues and simply warns you
   463  the errors are happening.
   464  
   465  **Note**: The ideal is to pursue a `docker` daemon and environment
   466  that does support synchronizing with `udev`. For further discussion on
   467  this topic, see
   468  [docker#4036](https://github.com/docker/docker/issues/4036).
   469  Otherwise, set this flag for migrating existing Docker daemons to a
   470  daemon with a supported environment.
   471  
   472  #### dm.min_free_space
   473  
   474  Specifies the min free space percent in thin pool require for new device
   475  creation to succeed. This check applies to both free data space as well
   476  as free metadata space. Valid values are from 0% - 99%. Value 0% disables
   477  free space checking logic. If user does not specify a value for this optoin,
   478  then default value for this option is 10%.
   479  
   480  Whenever a new thin pool device is created (during docker pull or
   481  during container creation), docker will check minimum free space is
   482  available as specified by this parameter. If that is not the case, then
   483  device creation will fail and docker operation will fail.
   484  
   485  One will have to create more free space in thin pool to recover from the
   486  error. Either delete some of the images and containers from thin pool and
   487  create free space or add more storage to thin pool.
   488  
   489  For lvm thin pool, one can add more storage to volume group container thin
   490  pool and that should automatically resolve it. If loop devices are being
   491  used, then stop docker, grow the size of loop files and restart docker and
   492  that should resolve the issue.
   493  
   494  Example use: `docker daemon --storage-opt dm.min_free_space=10%`
   495  
   496  ## ZFS options
   497  
   498  #### zfs.fsname
   499  
   500  Set zfs filesystem under which docker will create its own datasets.
   501  By default docker will pick up the zfs filesystem where docker graph
   502  (`/var/lib/docker`) is located.
   503  
   504  Example use: `docker daemon -s zfs --storage-opt zfs.fsname=zroot/docker`
   505  
   506  # CLUSTER STORE OPTIONS
   507  
   508  The daemon uses libkv to advertise
   509  the node within the cluster.  Some Key/Value backends support mutual
   510  TLS, and the client TLS settings used by the daemon can be configured
   511  using the **--cluster-store-opt** flag, specifying the paths to PEM encoded
   512  files.
   513  
   514  #### kv.cacertfile
   515  
   516  Specifies the path to a local file with PEM encoded CA certificates to trust
   517  
   518  #### kv.certfile
   519  
   520  Specifies the path to a local file with a PEM encoded certificate.  This
   521  certificate is used as the client cert for communication with the
   522  Key/Value store.
   523  
   524  #### kv.keyfile
   525  
   526  Specifies the path to a local file with a PEM encoded private key.  This
   527  private key is used as the client key for communication with the
   528  Key/Value store.
   529  
   530  # Access authorization
   531  
   532  Docker's access authorization can be extended by authorization plugins that your
   533  organization can purchase or build themselves. You can install one or more
   534  authorization plugins when you start the Docker `daemon` using the
   535  `--authorization-plugin=PLUGIN_ID` option.
   536  
   537  ```bash
   538  docker daemon --authorization-plugin=plugin1 --authorization-plugin=plugin2,...
   539  ```
   540  
   541  The `PLUGIN_ID` value is either the plugin's name or a path to its specification
   542  file. The plugin's implementation determines whether you can specify a name or
   543  path. Consult with your Docker administrator to get information about the
   544  plugins available to you.
   545  
   546  Once a plugin is installed, requests made to the `daemon` through the command
   547  line or Docker's remote API are allowed or denied by the plugin.  If you have
   548  multiple plugins installed, at least one must allow the request for it to
   549  complete.
   550  
   551  For information about how to create an authorization plugin, see [authorization
   552  plugin](https://docs.docker.com/engine/extend/authorization/) section in the
   553  Docker extend section of this documentation.
   554  
   555  
   556  # HISTORY
   557  Sept 2015, Originally compiled by Shishir Mahajan <shishir.mahajan@redhat.com>
   558  based on docker.com source material and internal work.