github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/man/docker.1.md (about)

     1  % DOCKER(1) Docker User Manuals
     2  % William Henry
     3  % APRIL 2014
     4  # NAME
     5  docker \- Docker image and container command line interface
     6  
     7  # SYNOPSIS
     8  **docker** [OPTIONS] COMMAND [arg...]
     9  
    10  # DESCRIPTION
    11  **docker** has two distinct functions. It is used for starting the Docker
    12  daemon and to run the CLI (i.e., to command the daemon to manage images,
    13  containers etc.) So **docker** is both a server, as a daemon, and a client
    14  to the daemon, through the CLI.
    15  
    16  To run the Docker daemon you do not specify any of the commands listed below but
    17  must specify the **-d** option.  The other options listed below are for the
    18  daemon only.
    19  
    20  The Docker CLI has over 30 commands. The commands are listed below and each has
    21  its own man page which explain usage and arguments.
    22  
    23  To see the man page for a command run **man docker <command>**.
    24  
    25  # OPTIONS
    26  **--help**
    27    Print usage statement
    28  
    29  **--api-cors-header**=""
    30    Set CORS headers in the remote API. Default is cors disabled. Give urls like "http://foo, http://bar, ...". Give "*" to allow all.
    31  
    32  **-b**, **--bridge**=""
    33    Attach containers to a pre\-existing network bridge; use 'none' to disable container networking
    34  
    35  **--bip**=""
    36    Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b
    37  
    38  **--config**=""
    39    Specifies the location of the Docker client configuration files. The default is '~/.docker'.
    40  
    41  **-D**, **--debug**=*true*|*false*
    42    Enable debug mode. Default is false.
    43  
    44  **-d**, **--daemon**=*true*|*false*
    45    Enable daemon mode. Default is false.
    46  
    47  **--default-gateway**=""
    48    IPv4 address of the container default gateway; this address must be part of the bridge subnet (which is defined by \-b or \--bip)
    49  
    50  **--default-gateway-v6**=""
    51    IPv6 address of the container default gateway
    52  
    53  **--default-ulimit**=[]
    54    Set default ulimits for containers.
    55  
    56  **--dns**=""
    57    Force Docker to use specific DNS servers
    58  
    59  **--dns-opt**=[]
    60    DNS options to use.
    61  
    62  **--dns-search**=[]
    63    DNS search domains to use.
    64  
    65  **-e**, **--exec-driver**=""
    66    Force Docker to use specific exec driver. Default is `native`.
    67  
    68  **--exec-opt**=[]
    69    Set exec driver options. See EXEC DRIVER OPTIONS.
    70  
    71  **--exec-root**=""
    72    Path to use as the root of the Docker exec driver. Default is `/var/run/docker`.
    73  
    74  **--fixed-cidr**=""
    75    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)
    76  
    77  **--fixed-cidr-v6**=""
    78    IPv6 subnet for global IPv6 addresses (e.g., 2a00:1450::/64)
    79  
    80  **-G**, **--group**=""
    81    Group to assign the unix socket specified by -H when running in daemon mode.
    82    use '' (the empty string) to disable setting of a group. Default is `docker`.
    83  
    84  **-g**, **--graph**=""
    85    Path to use as the root of the Docker runtime. Default is `/var/lib/docker`.
    86  
    87  **-H**, **--host**=[unix:///var/run/docker.sock]: tcp://[host:port] to bind or
    88  unix://[/path/to/socket] to use.
    89    The socket(s) to bind to in daemon mode specified using one or more
    90    tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
    91  
    92  **--icc**=*true*|*false*
    93    Allow unrestricted inter\-container and Docker daemon host communication. If disabled, containers can still be linked together using **--link** option (see **docker-run(1)**). Default is true.
    94  
    95  **--insecure-registry**=[]
    96    Enable insecure registry communication, i.e., enable un-encrypted and/or untrusted communication.
    97    
    98    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.
    99    
   100    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`. 
   101  
   102  **--ip**=""
   103    Default IP address to use when binding container ports. Default is `0.0.0.0`.
   104  
   105  **--ip-forward**=*true*|*false*
   106    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.
   107  
   108    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".
   109  
   110  **--ip-masq**=*true*|*false*
   111    Enable IP masquerading for bridge's IP range. Default is true.
   112  
   113  **--iptables**=*true*|*false*
   114    Enable Docker's addition of iptables rules. Default is true.
   115  
   116  **--ipv6**=*true*|*false*
   117    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".
   118  
   119  **-l**, **--log-level**="*debug*|*info*|*warn*|*error*|*fatal*""
   120    Set the logging level. Default is `info`.
   121  
   122  **--label**="[]"
   123    Set key=value labels to the daemon (displayed in `docker info`)
   124  
   125  **--log-driver**="*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*awslogs*|*none*"
   126    Default driver for container logs. Default is `json-file`.
   127    **Warning**: the `docker logs` command works only for the `json-file` and
   128    `journald` logging drivers.
   129  
   130  **--log-opt**=[]
   131    Logging driver specific options.
   132  
   133  **--mtu**=VALUE
   134    Set the containers network mtu. Default is `0`.
   135  
   136  **-p**, **--pidfile**=""
   137    Path to use for daemon PID file. Default is `/var/run/docker.pid`
   138  
   139  **--registry-mirror**=<scheme>://<host>
   140    Prepend a registry mirror to be used for image pulls. May be specified multiple times.
   141  
   142  **-s**, **--storage-driver**=""
   143    Force the Docker runtime to use a specific storage driver.
   144  
   145  **--selinux-enabled**=*true*|*false*
   146    Enable selinux support. Default is false. SELinux does not presently support the BTRFS storage driver.
   147  
   148  **--storage-opt**=[]
   149    Set storage driver options. See STORAGE DRIVER OPTIONS.
   150  
   151  **--tls**=*true*|*false*
   152    Use TLS; implied by --tlsverify. Default is false.
   153  
   154  **--tlscacert**=~/.docker/ca.pem
   155    Trust certs signed only by this CA.
   156  
   157  **--tlscert**=~/.docker/cert.pem
   158    Path to TLS certificate file.
   159  
   160  **--tlskey**=~/.docker/key.pem
   161    Path to TLS key file.
   162  
   163  **--tlsverify**=*true*|*false*
   164    Use TLS and verify the remote (daemon: verify client, client: verify daemon).
   165    Default is false.
   166  
   167  **--userland-proxy**=*true*|*false*
   168      Rely on a userland proxy implementation for inter-container and outside-to-container loopback communications. Default is true.
   169  
   170  **-v**, **--version**=*true*|*false*
   171    Print version information and quit. Default is false.
   172  
   173  # COMMANDS
   174  **attach**
   175    Attach to a running container
   176    See **docker-attach(1)** for full documentation on the **attach** command.
   177  
   178  **build**
   179    Build an image from a Dockerfile
   180    See **docker-build(1)** for full documentation on the **build** command.
   181  
   182  **commit**
   183    Create a new image from a container's changes
   184    See **docker-commit(1)** for full documentation on the **commit** command.
   185  
   186  **cp**
   187    Copy files/folders from a container's filesystem to the host
   188    See **docker-cp(1)** for full documentation on the **cp** command.
   189  
   190  **create**
   191    Create a new container
   192    See **docker-create(1)** for full documentation on the **create** command.
   193  
   194  **diff**
   195    Inspect changes on a container's filesystem
   196    See **docker-diff(1)** for full documentation on the **diff** command.
   197  
   198  **events**
   199    Get real time events from the server
   200    See **docker-events(1)** for full documentation on the **events** command.
   201  
   202  **exec**
   203    Run a command in a running container
   204    See **docker-exec(1)** for full documentation on the **exec** command.
   205  
   206  **export**
   207    Stream the contents of a container as a tar archive
   208    See **docker-export(1)** for full documentation on the **export** command.
   209  
   210  **history**
   211    Show the history of an image
   212    See **docker-history(1)** for full documentation on the **history** command.
   213  
   214  **images**
   215    List images
   216    See **docker-images(1)** for full documentation on the **images** command.
   217  
   218  **import**
   219    Create a new filesystem image from the contents of a tarball
   220    See **docker-import(1)** for full documentation on the **import** command.
   221  
   222  **info**
   223    Display system-wide information
   224    See **docker-info(1)** for full documentation on the **info** command.
   225  
   226  **inspect**
   227    Return low-level information on a container or image
   228    See **docker-inspect(1)** for full documentation on the **inspect** command.
   229  
   230  **kill**
   231    Kill a running container (which includes the wrapper process and everything
   232  inside it)
   233    See **docker-kill(1)** for full documentation on the **kill** command.
   234  
   235  **load**
   236    Load an image from a tar archive
   237    See **docker-load(1)** for full documentation on the **load** command.
   238  
   239  **login**
   240    Register or login to a Docker Registry
   241    See **docker-login(1)** for full documentation on the **login** command.
   242  
   243  **logout**
   244    Log the user out of a Docker Registry
   245    See **docker-logout(1)** for full documentation on the **logout** command.
   246  
   247  **logs**
   248    Fetch the logs of a container
   249    See **docker-logs(1)** for full documentation on the **logs** command.
   250  
   251  **pause**
   252    Pause all processes within a container
   253    See **docker-pause(1)** for full documentation on the **pause** command.
   254  
   255  **port**
   256    Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
   257    See **docker-port(1)** for full documentation on the **port** command.
   258  
   259  **ps**
   260    List containers
   261    See **docker-ps(1)** for full documentation on the **ps** command.
   262  
   263  **pull**
   264    Pull an image or a repository from a Docker Registry
   265    See **docker-pull(1)** for full documentation on the **pull** command.
   266  
   267  **push**
   268    Push an image or a repository to a Docker Registry
   269    See **docker-push(1)** for full documentation on the **push** command.
   270  
   271  **rename**
   272    Rename a container.
   273    See **docker-rename(1)** for full documentation on the **rename** command.
   274  
   275  **restart**
   276    Restart a container
   277    See **docker-restart(1)** for full documentation on the **restart** command.
   278  
   279  **rm**
   280    Remove one or more containers
   281    See **docker-rm(1)** for full documentation on the **rm** command.
   282  
   283  **rmi**
   284    Remove one or more images
   285    See **docker-rmi(1)** for full documentation on the **rmi** command.
   286  
   287  **run**
   288    Run a command in a new container
   289    See **docker-run(1)** for full documentation on the **run** command.
   290  
   291  **save**
   292    Save an image to a tar archive
   293    See **docker-save(1)** for full documentation on the **save** command.
   294  
   295  **search**
   296    Search for an image in the Docker index
   297    See **docker-search(1)** for full documentation on the **search** command.
   298  
   299  **start**
   300    Start a stopped container
   301    See **docker-start(1)** for full documentation on the **start** command.
   302  
   303  **stats**
   304    Display a live stream of one or more containers' resource usage statistics
   305    See **docker-stats(1)** for full documentation on the **stats** command.
   306  
   307  **stop**
   308    Stop a running container
   309    See **docker-stop(1)** for full documentation on the **stop** command.
   310  
   311  **tag**
   312    Tag an image into a repository
   313    See **docker-tag(1)** for full documentation on the **tag** command.
   314  
   315  **top**
   316    Lookup the running processes of a container
   317    See **docker-top(1)** for full documentation on the **top** command.
   318  
   319  **unpause**
   320    Unpause all processes within a container
   321    See **docker-unpause(1)** for full documentation on the **unpause** command.
   322  
   323  **version**
   324    Show the Docker version information
   325    See **docker-version(1)** for full documentation on the **version** command.
   326  
   327  **wait**
   328    Block until a container stops, then print its exit code
   329    See **docker-wait(1)** for full documentation on the **wait** command.
   330  
   331  # STORAGE DRIVER OPTIONS
   332  
   333  Docker uses storage backends (known as "graphdrivers" in the Docker
   334  internals) to create writable containers from images.  Many of these
   335  backends use operating system level technologies and can be
   336  configured.
   337  
   338  Specify options to the storage backend with **--storage-opt** flags. The only
   339  backend that currently takes options is *devicemapper*. Therefore use these
   340  flags with **-s=**devicemapper.
   341  
   342  Specifically for devicemapper, the default is a "loopback" model which
   343  requires no pre-configuration, but is extremely inefficient.  Do not
   344  use it in production.
   345  
   346  To make the best use of Docker with the devicemapper backend, you must
   347  have a recent version of LVM.  Use `lvm` to create a thin pool; for
   348  more information see `man lvmthin`.  Then, use `--storage-opt
   349  dm.thinpooldev` to tell the Docker engine to use that pool for
   350  allocating images and container snapshots.
   351  
   352  Here is the list of *devicemapper* options:
   353  
   354  #### dm.thinpooldev
   355  
   356  Specifies a custom block storage device to use for the thin pool.
   357  
   358  If using a block device for device mapper storage, it is best to use
   359  `lvm` to create and manage the thin-pool volume. This volume is then
   360  handed to Docker to create snapshot volumes needed for images and
   361  containers.
   362  
   363  Managing the thin-pool outside of Docker makes for the most feature-rich method
   364  of having Docker utilize device mapper thin provisioning as the backing storage
   365  for Docker's containers. The highlights of the LVM-based thin-pool management
   366  feature include: automatic or interactive thin-pool resize support, dynamically
   367  changing thin-pool features, automatic thinp metadata checking when lvm activates
   368  the thin-pool, etc.
   369  
   370  Example use: `docker daemon --storage-opt dm.thinpooldev=/dev/mapper/thin-pool`
   371  
   372  #### dm.basesize
   373  
   374  Specifies the size to use when creating the base device, which limits
   375  the size of images and containers. The default value is 100G. Note,
   376  thin devices are inherently "sparse", so a 100G device which is mostly
   377  empty doesn't use 100 GB of space on the pool. However, the filesystem
   378  will use more space for base images the larger the device
   379  is. 
   380  
   381  This value affects the system-wide "base" empty filesystem that may already
   382  be initialized and inherited by pulled images. Typically, a change to this
   383  value requires additional steps to take effect:
   384  
   385          $ sudo service docker stop
   386          $ sudo rm -rf /var/lib/docker
   387          $ sudo service docker start
   388  
   389  Example use: `docker daemon --storage-opt dm.basesize=20G`
   390  
   391  #### dm.fs
   392  
   393  Specifies the filesystem type to use for the base device. The
   394  supported options are `ext4` and `xfs`. The default is `ext4`.
   395  
   396  Example use: `docker daemon --storage-opt dm.fs=xfs`
   397  
   398  #### dm.mkfsarg
   399  
   400  Specifies extra mkfs arguments to be used when creating the base device.
   401  
   402  Example use: `docker daemon --storage-opt "dm.mkfsarg=-O ^has_journal"`
   403  
   404  #### dm.mountopt
   405  
   406  Specifies extra mount options used when mounting the thin devices.
   407  
   408  Example use: `docker daemon --storage-opt dm.mountopt=nodiscard`
   409  
   410  #### dm.use_deferred_removal
   411  
   412  Enables use of deferred device removal if `libdm` and the kernel driver
   413  support the mechanism.
   414  
   415  Deferred device removal means that if device is busy when devices are
   416  being removed/deactivated, then a deferred removal is scheduled on
   417  device. And devices automatically go away when last user of the device
   418  exits.
   419  
   420  For example, when a container exits, its associated thin device is removed. If
   421  that device has leaked into some other mount namespace and can't be removed,
   422  the container exit still succeeds and this option causes the system to schedule
   423  the device for deferred removal. It does not wait in a loop trying to remove a busy
   424  device.
   425  
   426  Example use: `docker daemon --storage-opt dm.use_deferred_removal=true`
   427  
   428  #### dm.loopdatasize
   429  
   430  **Note**: This option configures devicemapper loopback, which should not be used in production.
   431  
   432  Specifies the size to use when creating the loopback file for the
   433  "data" device which is used for the thin pool. The default size is
   434  100G. The file is sparse, so it will not initially take up
   435  this much space.
   436  
   437  Example use: `docker daemon --storage-opt dm.loopdatasize=200G`
   438  
   439  #### dm.loopmetadatasize
   440  
   441  **Note**: This option configures devicemapper loopback, which should not be used in production.
   442  
   443  Specifies the size to use when creating the loopback file for the
   444  "metadata" device which is used for the thin pool. The default size
   445  is 2G. The file is sparse, so it will not initially take up
   446  this much space.
   447  
   448  Example use: `docker daemon --storage-opt dm.loopmetadatasize=4G`
   449  
   450  #### dm.datadev
   451  
   452  (Deprecated, use `dm.thinpooldev`)
   453  
   454  Specifies a custom blockdevice to use for data for a
   455  Docker-managed thin pool.  It is better to use `dm.thinpooldev` - see
   456  the documentation for it above for discussion of the advantages.
   457  
   458  #### dm.metadatadev
   459  
   460  (Deprecated, use `dm.thinpooldev`)
   461  
   462  Specifies a custom blockdevice to use for metadata for a
   463  Docker-managed thin pool.  See `dm.datadev` for why this is
   464  deprecated.
   465  
   466  #### dm.blocksize
   467  
   468  Specifies a custom blocksize to use for the thin pool.  The default
   469  blocksize is 64K.
   470  
   471  Example use: `docker daemon --storage-opt dm.blocksize=512K`
   472  
   473  #### dm.blkdiscard
   474  
   475  Enables or disables the use of `blkdiscard` when removing devicemapper
   476  devices.  This is disabled by default due to the additional latency,
   477  but as a special case with loopback devices it will be enabled, in
   478  order to re-sparsify the loopback file on image/container removal.
   479  
   480  Disabling this on loopback can lead to *much* faster container removal
   481  times, but it also prevents the space used in `/var/lib/docker` directory
   482  from being returned to the system for other use when containers are
   483  removed.
   484  
   485  Example use: `docker daemon --storage-opt dm.blkdiscard=false`
   486  
   487  #### dm.override_udev_sync_check
   488  
   489  By default, the devicemapper backend attempts to synchronize with the
   490  `udev` device manager for the Linux kernel.  This option allows
   491  disabling that synchronization, to continue even though the
   492  configuration may be buggy.
   493  
   494  To view the `udev` sync support of a Docker daemon that is using the
   495  `devicemapper` driver, run:
   496  
   497          $ docker info
   498  	[...]
   499  	 Udev Sync Supported: true
   500  	[...]
   501  
   502  When `udev` sync support is `true`, then `devicemapper` and `udev` can
   503  coordinate the activation and deactivation of devices for containers.
   504  
   505  When `udev` sync support is `false`, a race condition occurs between
   506  the `devicemapper` and `udev` during create and cleanup. The race
   507  condition results in errors and failures. (For information on these
   508  failures, see
   509  [docker#4036](https://github.com/docker/docker/issues/4036))
   510  
   511  To allow the `docker` daemon to start, regardless of whether `udev` sync is
   512  `false`, set `dm.override_udev_sync_check` to true:
   513  
   514          $ docker daemon --storage-opt dm.override_udev_sync_check=true
   515  
   516  When this value is `true`, the driver continues and simply warns you
   517  the errors are happening.
   518  
   519  **Note**: The ideal is to pursue a `docker` daemon and environment
   520  that does support synchronizing with `udev`. For further discussion on
   521  this topic, see
   522  [docker#4036](https://github.com/docker/docker/issues/4036).
   523  Otherwise, set this flag for migrating existing Docker daemons to a
   524  daemon with a supported environment.
   525  
   526  # EXEC DRIVER OPTIONS
   527  
   528  Use the **--exec-opt** flags to specify options to the exec-driver. The only
   529  driver that accepts this flag is the *native* (libcontainer) driver. As a
   530  result, you must also specify **-s=**native for this option to have effect. The 
   531  following is the only *native* option:
   532  
   533  #### native.cgroupdriver
   534  Specifies the management of the container's `cgroups`. You can specify 
   535  `cgroupfs` or `systemd`. If you specify `systemd` and it is not available, the 
   536  system uses `cgroupfs`.
   537  
   538  #### Client
   539  For specific client examples please see the man page for the specific Docker
   540  command. For example:
   541  
   542      man docker-run
   543  
   544  # HISTORY
   545  April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.