github.com/nguyentm83/docker@v1.5.0/docs/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 **-D**=*true*|*false* 27 Enable debug mode. Default is false. 28 29 **--help** 30 Print usage statement 31 32 **-H**, **--host**=[unix:///var/run/docker.sock]: tcp://[host:port] to bind or 33 unix://[/path/to/socket] to use. 34 The socket(s) to bind to in daemon mode specified using one or more 35 tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd. 36 37 **--api-enable-cors**=*true*|*false* 38 Enable CORS headers in the remote API. Default is false. 39 40 **-b**="" 41 Attach containers to a pre\-existing network bridge; use 'none' to disable container networking 42 43 **--bip**="" 44 Use the provided CIDR notation address for the dynamically created bridge (docker0); Mutually exclusive of \-b 45 46 **-d**=*true*|*false* 47 Enable daemon mode. Default is false. 48 49 **--dns**="" 50 Force Docker to use specific DNS servers 51 52 **-g**="" 53 Path to use as the root of the Docker runtime. Default is `/var/lib/docker`. 54 55 **--fixed-cidr**="" 56 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) 57 58 **--fixed-cidr-v6**="" 59 IPv6 subnet for global IPv6 addresses (e.g., 2a00:1450::/64) 60 61 **--icc**=*true*|*false* 62 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. 63 64 **--ip**="" 65 Default IP address to use when binding container ports. Default is `0.0.0.0`. 66 67 **--ip-forward**=*true*|*false* 68 Docker will enable IP forwarding. Default is true. If `--fixed-cidr-v6` 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". 69 70 **--ip-masq**=*true*|*false* 71 Enable IP masquerading for bridge's IP range. Default is true. 72 73 **--iptables**=*true*|*false* 74 Disable Docker's addition of iptables rules. Default is true. 75 76 **--ipv6**=*true*|*false* 77 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". 78 79 **-l**, **--log-level**="*debug*|*info*|*warn*|*error*|*fatal*"" 80 Set the logging level. Default is `info`. 81 82 **--label**="[]" 83 Set key=value labels to the daemon (displayed in `docker info`) 84 85 **--mtu**=VALUE 86 Set the containers network mtu. Default is `1500`. 87 88 **-p**="" 89 Path to use for daemon PID file. Default is `/var/run/docker.pid` 90 91 **--registry-mirror**=<scheme>://<host> 92 Prepend a registry mirror to be used for image pulls. May be specified multiple times. 93 94 **-s**="" 95 Force the Docker runtime to use a specific storage driver. 96 97 **--storage-opt**=[] 98 Set storage driver options. See STORAGE DRIVER OPTIONS. 99 100 **-v**=*true*|*false* 101 Print version information and quit. Default is false. 102 103 **--selinux-enabled**=*true*|*false* 104 Enable selinux support. Default is false. SELinux does not presently support the BTRFS storage driver. 105 106 # COMMANDS 107 **docker-attach(1)** 108 Attach to a running container 109 110 **docker-build(1)** 111 Build an image from a Dockerfile 112 113 **docker-commit(1)** 114 Create a new image from a container's changes 115 116 **docker-cp(1)** 117 Copy files/folders from a container's filesystem to the host at path 118 119 **docker-create(1)** 120 Create a new container 121 122 **docker-diff(1)** 123 Inspect changes on a container's filesystem 124 125 **docker-events(1)** 126 Get real time events from the server 127 128 **docker-exec(1)** 129 Run a command in a running container 130 131 **docker-export(1)** 132 Stream the contents of a container as a tar archive 133 134 **docker-history(1)** 135 Show the history of an image 136 137 **docker-images(1)** 138 List images 139 140 **docker-import(1)** 141 Create a new filesystem image from the contents of a tarball 142 143 **docker-info(1)** 144 Display system-wide information 145 146 **docker-inspect(1)** 147 Return low-level information on a container or image 148 149 **docker-kill(1)** 150 Kill a running container (which includes the wrapper process and everything 151 inside it) 152 153 **docker-load(1)** 154 Load an image from a tar archive 155 156 **docker-login(1)** 157 Register or Login to a Docker registry server 158 159 **docker-logout(1)** 160 Log the user out of a Docker registry server 161 162 **docker-logs(1)** 163 Fetch the logs of a container 164 165 **docker-pause(1)** 166 Pause all processes within a container 167 168 **docker-port(1)** 169 Lookup the public-facing port which is NAT-ed to PRIVATE_PORT 170 171 **docker-ps(1)** 172 List containers 173 174 **docker-pull(1)** 175 Pull an image or a repository from a Docker registry server 176 177 **docker-push(1)** 178 Push an image or a repository to a Docker registry server 179 180 **docker-restart(1)** 181 Restart a running container 182 183 **docker-rm(1)** 184 Remove one or more containers 185 186 **docker-rmi(1)** 187 Remove one or more images 188 189 **docker-run(1)** 190 Run a command in a new container 191 192 **docker-save(1)** 193 Save an image to a tar archive 194 195 **docker-search(1)** 196 Search for an image in the Docker index 197 198 **docker-start(1)** 199 Start a stopped container 200 201 **docker-stop(1)** 202 Stop a running container 203 204 **docker-tag(1)** 205 Tag an image into a repository 206 207 **docker-top(1)** 208 Lookup the running processes of a container 209 210 **docker-unpause(1)** 211 Unpause all processes within a container 212 213 **docker-version(1)** 214 Show the Docker version information 215 216 **docker-wait(1)** 217 Block until a container stops, then print its exit code 218 219 # STORAGE DRIVER OPTIONS 220 221 Options to storage backend can be specified with **--storage-opt** flags. The 222 only backend which currently takes options is *devicemapper*. Therefore use these 223 flags with **-s=**devicemapper. 224 225 Here is the list of *devicemapper* options: 226 227 #### dm.basesize 228 Specifies the size to use when creating the base device, which limits the size 229 of images and containers. The default value is 10G. Note, thin devices are 230 inherently "sparse", so a 10G device which is mostly empty doesn't use 10 GB 231 of space on the pool. However, the filesystem will use more space for the empty 232 case the larger the device is. **Warning**: This value affects the system-wide 233 "base" empty filesystem that may already be initialized and inherited by pulled 234 images. 235 236 #### dm.loopdatasize 237 Specifies the size to use when creating the loopback file for the "data" 238 device which is used for the thin pool. The default size is 100G. Note that the 239 file is sparse, so it will not initially take up this much space. 240 241 #### dm.loopmetadatasize 242 Specifies the size to use when creating the loopback file for the "metadadata" 243 device which is used for the thin pool. The default size is 2G. Note that the 244 file is sparse, so it will not initially take up this much space. 245 246 #### dm.fs 247 Specifies the filesystem type to use for the base device. The supported 248 options are "ext4" and "xfs". The default is "ext4" 249 250 #### dm.mkfsarg 251 Specifies extra mkfs arguments to be used when creating the base device. 252 253 #### dm.mountopt 254 Specifies extra mount options used when mounting the thin devices. 255 256 #### dm.datadev 257 Specifies a custom blockdevice to use for data for the thin pool. 258 259 If using a block device for device mapper storage, ideally both datadev and 260 metadatadev should be specified to completely avoid using the loopback device. 261 262 #### dm.metadatadev 263 Specifies a custom blockdevice to use for metadata for the thin pool. 264 265 For best performance the metadata should be on a different spindle than the 266 data, or even better on an SSD. 267 268 If setting up a new metadata pool it is required to be valid. This can be 269 achieved by zeroing the first 4k to indicate empty metadata, like this: 270 271 dd if=/dev/zero of=/dev/metadata_dev bs=4096 count=1 272 273 #### dm.blocksize 274 Specifies a custom blocksize to use for the thin pool. The default blocksize 275 is 64K. 276 277 #### dm.blkdiscard 278 Enables or disables the use of blkdiscard when removing devicemapper devices. 279 This is enabled by default (only) if using loopback devices and is required to 280 resparsify the loopback file on image/container removal. 281 282 Disabling this on loopback can lead to *much* faster container removal times, 283 but will prevent the space used in `/var/lib/docker` directory from being returned to 284 the system for other use when containers are removed. 285 286 # EXAMPLES 287 Launching docker daemon with *devicemapper* backend with particular block devices 288 for data and metadata: 289 290 docker -d -s=devicemapper \ 291 --storage-opt dm.datadev=/dev/vdb \ 292 --storage-opt dm.metadatadev=/dev/vdc \ 293 --storage-opt dm.basesize=20G 294 295 #### Client 296 For specific client examples please see the man page for the specific Docker 297 command. For example: 298 299 man docker run 300 301 # HISTORY 302 April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.