.TH "DOCKER" "1" " Docker User Manuals" "William Henry" "APRIL 2014" "" .SH NAME .PP docker \- Docker image and container command line interface .SH SYNOPSIS .PP \fBdocker\fP [OPTIONS] COMMAND [arg...] .SH DESCRIPTION .PP \fBdocker\fP has two distinct functions. It is used for starting the Docker daemon and to run the CLI (i.e., to command the daemon to manage images, containers etc.) So \fBdocker\fP is both a server, as a daemon, and a client to the daemon, through the CLI. .PP To run the Docker daemon you do not specify any of the commands listed below but must specify the \fB\-d\fP option. The other options listed below are for the daemon only. .PP The Docker CLI has over 30 commands. The commands are listed below and each has its own man page which explain usage and arguments. .PP To see the man page for a command run \fBman docker \fP. .SH OPTIONS .PP \fB\-h\fP, \fB\-\-help\fP Print usage statement .PP \fB\-\-api\-cors\-header\fP="" Set CORS headers in the remote API. Default is cors disabled. Give urls like " \[la]http://foo\[ra], \[la]http://bar\[ra], ...". Give "*" to allow all. .PP \fB\-b\fP, \fB\-\-bridge\fP="" Attach containers to a pre\-existing network bridge; use 'none' to disable container networking .PP \fB\-\-bip\fP="" Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b .PP \fB\-D\fP, \fB\-\-debug\fP=\fItrue\fP|\fIfalse\fP Enable debug mode. Default is false. .PP \fB\-d\fP, \fB\-\-daemon\fP=\fItrue\fP|\fIfalse\fP Enable daemon mode. Default is false. .PP \fB\-\-dns\fP="" Force Docker to use specific DNS servers .PP \fB\-e\fP, \fB\-\-exec\-driver\fP="" Force Docker to use specific exec driver. Default is \fB\fCnative\fR. .PP \fB\-\-fixed\-cidr\fP="" 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) .PP \fB\-\-fixed\-cidr\-v6\fP="" IPv6 subnet for global IPv6 addresses (e.g., 2a00:1450::/64) .PP \fB\-G\fP, \fB\-\-group\fP="" Group to assign the unix socket specified by \-H when running in daemon mode. use '' (the empty string) to disable setting of a group. Default is \fB\fCdocker\fR. .PP \fB\-g\fP, \fB\-\-graph\fP="" Path to use as the root of the Docker runtime. Default is \fB\fC/var/lib/docker\fR. .PP \fB\-H\fP, \fB\-\-host\fP=[unix:///var/run/docker.sock]: tcp://[host:port] to bind or unix://[/path/to/socket] to use. The socket(s) to bind to in daemon mode specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd. .PP \fB\-\-icc\fP=\fItrue\fP|\fIfalse\fP Allow unrestricted inter\-container and Docker daemon host communication. If disabled, containers can still be linked together using \fB\-\-link\fP option (see \fBdocker\-run(1)\fP). Default is true. .PP \fB\-\-ip\fP="" Default IP address to use when binding container ports. Default is \fB\fC0.0.0.0\fR. .PP \fB\-\-ip\-forward\fP=\fItrue\fP|\fIfalse\fP Docker will enable IP forwarding. Default is true. If \fB\fC\-\-fixed\-cidr\-v6\fR is set. IPv6 forwarding will be activated, too. 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". .PP \fB\-\-ip\-masq\fP=\fItrue\fP|\fIfalse\fP Enable IP masquerading for bridge's IP range. Default is true. .PP \fB\-\-iptables\fP=\fItrue\fP|\fIfalse\fP Enable Docker's addition of iptables rules. Default is true. .PP \fB\-\-ipv6\fP=\fItrue\fP|\fIfalse\fP 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 \fB\fC\-\-fixed\-cidr\-v6\fR to provide globally routable IPv6 addresses. IPv6 forwarding will be enabled if not used with \fB\fC\-\-ip\-forward=false\fR. This may collide with your host's current IPv6 settings. For more information please consult the documentation about "Advanced Networking \- IPv6". .PP \fB\-l\fP, \fB\-\-log\-level\fP="\fIdebug\fP|\fIinfo\fP|\fIwarn\fP|\fIerror\fP|\fIfatal\fP"" Set the logging level. Default is \fB\fCinfo\fR. .PP \fB\-\-label\fP="[]" Set key=value labels to the daemon (displayed in \fB\fCdocker info\fR) .PP \fB\-\-log\-driver\fP="\fIjson\-file\fP|\fIsyslog\fP|\fInone\fP" Container's logging driver. Default is \fB\fCdefault\fR. \fBWarning\fP: \fB\fCdocker logs\fR command works only for \fB\fCjson\-file\fR logging driver. .PP \fB\-\-mtu\fP=VALUE Set the containers network mtu. Default is \fB\fC0\fR. .PP \fB\-p\fP, \fB\-\-pidfile\fP="" Path to use for daemon PID file. Default is \fB\fC/var/run/docker.pid\fR .PP \fB\-\-registry\-mirror\fP=:// Prepend a registry mirror to be used for image pulls. May be specified multiple times. .PP \fB\-s\fP, \fB\-\-storage\-driver\fP="" Force the Docker runtime to use a specific storage driver. .PP \fB\-\-storage\-opt\fP=[] Set storage driver options. See STORAGE DRIVER OPTIONS. .PP \fB\-tls\fP=\fItrue\fP|\fIfalse\fP Use TLS; implied by \-\-tlsverify. Default is false. .PP \fB\-tlsverify\fP=\fItrue\fP|\fIfalse\fP Use TLS and verify the remote (daemon: verify client, client: verify daemon). Default is false. .PP \fB\-v\fP, \fB\-\-version\fP=\fItrue\fP|\fIfalse\fP Print version information and quit. Default is false. .PP \fB\-\-selinux\-enabled\fP=\fItrue\fP|\fIfalse\fP Enable selinux support. Default is false. SELinux does not presently support the BTRFS storage driver. .SH COMMANDS .PP \fBdocker\-attach(1)\fP Attach to a running container .PP \fBdocker\-build(1)\fP Build an image from a Dockerfile .PP \fBdocker\-commit(1)\fP Create a new image from a container's changes .PP \fBdocker\-cp(1)\fP Copy files/folders from a container's filesystem to the host .PP \fBdocker\-create(1)\fP Create a new container .PP \fBdocker\-diff(1)\fP Inspect changes on a container's filesystem .PP \fBdocker\-events(1)\fP Get real time events from the server .PP \fBdocker\-exec(1)\fP Run a command in a running container .PP \fBdocker\-export(1)\fP Stream the contents of a container as a tar archive .PP \fBdocker\-history(1)\fP Show the history of an image .PP \fBdocker\-images(1)\fP List images .PP \fBdocker\-import(1)\fP Create a new filesystem image from the contents of a tarball .PP \fBdocker\-info(1)\fP Display system\-wide information .PP \fBdocker\-inspect(1)\fP Return low\-level information on a container or image .PP \fBdocker\-kill(1)\fP Kill a running container (which includes the wrapper process and everything inside it) .PP \fBdocker\-load(1)\fP Load an image from a tar archive .PP \fBdocker\-login(1)\fP Register or login to a Docker Registry Service .PP \fBdocker\-logout(1)\fP Log the user out of a Docker Registry Service .PP \fBdocker\-logs(1)\fP Fetch the logs of a container .PP \fBdocker\-pause(1)\fP Pause all processes within a container .PP \fBdocker\-port(1)\fP Lookup the public\-facing port which is NAT\-ed to PRIVATE\_PORT .PP \fBdocker\-ps(1)\fP List containers .PP \fBdocker\-pull(1)\fP Pull an image or a repository from a Docker Registry Service .PP \fBdocker\-push(1)\fP Push an image or a repository to a Docker Registry Service .PP \fBdocker\-restart(1)\fP Restart a running container .PP \fBdocker\-rm(1)\fP Remove one or more containers .PP \fBdocker\-rmi(1)\fP Remove one or more images .PP \fBdocker\-run(1)\fP Run a command in a new container .PP \fBdocker\-save(1)\fP Save an image to a tar archive .PP \fBdocker\-search(1)\fP Search for an image in the Docker index .PP \fBdocker\-start(1)\fP Start a stopped container .PP \fBdocker\-stats(1)\fP Display a live stream of one or more containers' resource usage statistics .PP \fBdocker\-stop(1)\fP Stop a running container .PP \fBdocker\-tag(1)\fP Tag an image into a repository .PP \fBdocker\-top(1)\fP Lookup the running processes of a container .PP \fBdocker\-unpause(1)\fP Unpause all processes within a container .PP \fBdocker\-version(1)\fP Show the Docker version information .PP \fBdocker\-wait(1)\fP Block until a container stops, then print its exit code .SH STORAGE DRIVER OPTIONS .PP Options to storage backend can be specified with \fB\-\-storage\-opt\fP flags. The only backend which currently takes options is \fIdevicemapper\fP. Therefore use these flags with \fB\-s=\fPdevicemapper. .PP Here is the list of \fIdevicemapper\fP options: .SS dm.basesize .PP Specifies the size to use when creating the base device, which limits the size of images and containers. The default value is 10G. Note, thin devices are inherently "sparse", so a 10G device which is mostly empty doesn't use 10 GB of space on the pool. However, the filesystem will use more space for the empty case the larger the device is. \fBWarning\fP: This value affects the system\-wide "base" empty filesystem that may already be initialized and inherited by pulled images. .SS dm.loopdatasize .PP Specifies the size to use when creating the loopback file for the "data" device which is used for the thin pool. The default size is 100G. Note that the file is sparse, so it will not initially take up this much space. .SS dm.loopmetadatasize .PP Specifies the size to use when creating the loopback file for the "metadadata" device which is used for the thin pool. The default size is 2G. Note that the file is sparse, so it will not initially take up this much space. .SS dm.fs .PP Specifies the filesystem type to use for the base device. The supported options are "ext4" and "xfs". The default is "ext4" .SS dm.mkfsarg .PP Specifies extra mkfs arguments to be used when creating the base device. .SS dm.mountopt .PP Specifies extra mount options used when mounting the thin devices. .SS dm.datadev .PP Specifies a custom blockdevice to use for data for the thin pool. .PP If using a block device for device mapper storage, ideally both datadev and metadatadev should be specified to completely avoid using the loopback device. .SS dm.metadatadev .PP Specifies a custom blockdevice to use for metadata for the thin pool. .PP For best performance the metadata should be on a different spindle than the data, or even better on an SSD. .PP If setting up a new metadata pool it is required to be valid. This can be achieved by zeroing the first 4k to indicate empty metadata, like this: .PP .RS .nf dd if=/dev/zero of=/dev/metadata\_dev bs=4096 count=1 .fi .RE .SS dm.blocksize .PP Specifies a custom blocksize to use for the thin pool. The default blocksize is 64K. .SS dm.blkdiscard .PP Enables or disables the use of blkdiscard when removing devicemapper devices. This is enabled by default (only) if using loopback devices and is required to resparsify the loopback file on image/container removal. .PP Disabling this on loopback can lead to \fImuch\fP faster container removal times, but will prevent the space used in \fB\fC/var/lib/docker\fR directory from being returned to the system for other use when containers are removed. .SH EXAMPLES .PP Launching docker daemon with \fIdevicemapper\fP backend with particular block devices for data and metadata: .PP .RS .nf docker \-d \-s=devicemapper \\ \-\-storage\-opt dm.datadev=/dev/vdb \\ \-\-storage\-opt dm.metadatadev=/dev/vdc \\ \-\-storage\-opt dm.basesize=20G .fi .RE .SS Client .PP For specific client examples please see the man page for the specific Docker command. For example: .PP .RS .nf man docker\-run .fi .RE .SH HISTORY .PP April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.