github.com/jogo/docker@v1.7.0-rc1/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 **-h**, **--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 **-D**, **--debug**=*true*|*false* 39 Enable debug mode. Default is false. 40 41 **-d**, **--daemon**=*true*|*false* 42 Enable daemon mode. Default is false. 43 44 **--default-gateway**="" 45 IPv4 address of the container default gateway; this address must be part of the bridge subnet (which is defined by \-b or \--bip) 46 47 **--default-gateway-v6**="" 48 IPv6 address of the container default gateway 49 50 **--dns**="" 51 Force Docker to use specific DNS servers 52 53 **-e**, **--exec-driver**="" 54 Force Docker to use specific exec driver. Default is `native`. 55 56 **--exec-opt**=[] 57 Set exec driver options. See EXEC DRIVER OPTIONS. 58 59 **--exec-root**="" 60 Path to use as the root of the Docker execdriver. Default is `/var/run/docker`. 61 62 **--fixed-cidr**="" 63 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) 64 65 **--fixed-cidr-v6**="" 66 IPv6 subnet for global IPv6 addresses (e.g., 2a00:1450::/64) 67 68 **-G**, **--group**="" 69 Group to assign the unix socket specified by -H when running in daemon mode. 70 use '' (the empty string) to disable setting of a group. Default is `docker`. 71 72 **-g**, **--graph**="" 73 Path to use as the root of the Docker runtime. Default is `/var/lib/docker`. 74 75 **-H**, **--host**=[unix:///var/run/docker.sock]: tcp://[host:port] to bind or 76 unix://[/path/to/socket] to use. 77 The socket(s) to bind to in daemon mode specified using one or more 78 tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd. 79 80 **--icc**=*true*|*false* 81 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. 82 83 **--ip**="" 84 Default IP address to use when binding container ports. Default is `0.0.0.0`. 85 86 **--ip-forward**=*true*|*false* 87 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". 88 89 **--ip-masq**=*true*|*false* 90 Enable IP masquerading for bridge's IP range. Default is true. 91 92 **--iptables**=*true*|*false* 93 Enable Docker's addition of iptables rules. Default is true. 94 95 **--ipv6**=*true*|*false* 96 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". 97 98 **-l**, **--log-level**="*debug*|*info*|*warn*|*error*|*fatal*"" 99 Set the logging level. Default is `info`. 100 101 **--label**="[]" 102 Set key=value labels to the daemon (displayed in `docker info`) 103 104 **--log-driver**="*json-file*|*syslog*|*journald*|*none*" 105 Default driver for container logs. Default is `json-file`. 106 **Warning**: `docker logs` command works only for `json-file` logging driver. 107 108 **--mtu**=VALUE 109 Set the containers network mtu. Default is `0`. 110 111 **-p**, **--pidfile**="" 112 Path to use for daemon PID file. Default is `/var/run/docker.pid` 113 114 **--registry-mirror**=<scheme>://<host> 115 Prepend a registry mirror to be used for image pulls. May be specified multiple times. 116 117 **-s**, **--storage-driver**="" 118 Force the Docker runtime to use a specific storage driver. 119 120 **--selinux-enabled**=*true*|*false* 121 Enable selinux support. Default is false. SELinux does not presently support the BTRFS storage driver. 122 123 **--storage-opt**=[] 124 Set storage driver options. See STORAGE DRIVER OPTIONS. 125 126 **-tls**=*true*|*false* 127 Use TLS; implied by --tlsverify. Default is false. 128 129 **-tlsverify**=*true*|*false* 130 Use TLS and verify the remote (daemon: verify client, client: verify daemon). 131 Default is false. 132 133 **--userland-proxy**=*true*|*false* 134 Rely on a userland proxy implementation for inter-container and outside-to-container loopback communications. Default is true. 135 136 **-v**, **--version**=*true*|*false* 137 Print version information and quit. Default is false. 138 139 # COMMANDS 140 **attach** 141 Attach to a running container 142 See **docker-attach(1)** for full documentation on the **attach** command. 143 144 **build** 145 Build an image from a Dockerfile 146 See **docker-build(1)** for full documentation on the **build** command. 147 148 **commit** 149 Create a new image from a container's changes 150 See **docker-commit(1)** for full documentation on the **commit** command. 151 152 **cp** 153 Copy files/folders from a container's filesystem to the host 154 See **docker-cp(1)** for full documentation on the **cp** command. 155 156 **create** 157 Create a new container 158 See **docker-create(1)** for full documentation on the **create** command. 159 160 **diff** 161 Inspect changes on a container's filesystem 162 See **docker-diff(1)** for full documentation on the **diff** command. 163 164 **events** 165 Get real time events from the server 166 See **docker-events(1)** for full documentation on the **events** command. 167 168 **exec** 169 Run a command in a running container 170 See **docker-exec(1)** for full documentation on the **exec** command. 171 172 **export** 173 Stream the contents of a container as a tar archive 174 See **docker-export(1)** for full documentation on the **export** command. 175 176 **history** 177 Show the history of an image 178 See **docker-history(1)** for full documentation on the **history** command. 179 180 **images** 181 List images 182 See **docker-images(1)** for full documentation on the **images** command. 183 184 **import** 185 Create a new filesystem image from the contents of a tarball 186 See **docker-import(1)** for full documentation on the **import** command. 187 188 **info** 189 Display system-wide information 190 See **docker-info(1)** for full documentation on the **info** command. 191 192 **inspect** 193 Return low-level information on a container or image 194 See **docker-inspect(1)** for full documentation on the **inspect** command. 195 196 **kill** 197 Kill a running container (which includes the wrapper process and everything 198 inside it) 199 See **docker-kill(1)** for full documentation on the **kill** command. 200 201 **load** 202 Load an image from a tar archive 203 See **docker-load(1)** for full documentation on the **load** command. 204 205 **login** 206 Register or login to a Docker Registry 207 See **docker-login(1)** for full documentation on the **login** command. 208 209 **logout** 210 Log the user out of a Docker Registry 211 See **docker-logout(1)** for full documentation on the **logout** command. 212 213 **logs** 214 Fetch the logs of a container 215 See **docker-logs(1)** for full documentation on the **logs** command. 216 217 **pause** 218 Pause all processes within a container 219 See **docker-pause(1)** for full documentation on the **pause** command. 220 221 **port** 222 Lookup the public-facing port which is NAT-ed to PRIVATE_PORT 223 See **docker-port(1)** for full documentation on the **port** command. 224 225 **ps** 226 List containers 227 See **docker-ps(1)** for full documentation on the **ps** command. 228 229 **pull** 230 Pull an image or a repository from a Docker Registry 231 See **docker-pull(1)** for full documentation on the **pull** command. 232 233 **push** 234 Push an image or a repository to a Docker Registry 235 See **docker-push(1)** for full documentation on the **push** command. 236 237 **restart** 238 Restart a running container 239 See **docker-restart(1)** for full documentation on the **restart** command. 240 241 **rm** 242 Remove one or more containers 243 See **docker-rm(1)** for full documentation on the **rm** command. 244 245 **rmi** 246 Remove one or more images 247 See **docker-rmi(1)** for full documentation on the **rmi** command. 248 249 **run** 250 Run a command in a new container 251 See **docker-run(1)** for full documentation on the **run** command. 252 253 **save** 254 Save an image to a tar archive 255 See **docker-save(1)** for full documentation on the **save** command. 256 257 **search** 258 Search for an image in the Docker index 259 See **docker-search(1)** for full documentation on the **search** command. 260 261 **start** 262 Start a stopped container 263 See **docker-start(1)** for full documentation on the **start** command. 264 265 **stats** 266 Display a live stream of one or more containers' resource usage statistics 267 See **docker-stats(1)** for full documentation on the **stats** command. 268 269 **stop** 270 Stop a running container 271 See **docker-stop(1)** for full documentation on the **stop** command. 272 273 **tag** 274 Tag an image into a repository 275 See **docker-tag(1)** for full documentation on the **tag** command. 276 277 **top** 278 Lookup the running processes of a container 279 See **docker-top(1)** for full documentation on the **top** command. 280 281 **unpause** 282 Unpause all processes within a container 283 See **docker-unpause(1)** for full documentation on the **unpause** command. 284 285 **version** 286 Show the Docker version information 287 See **docker-version(1)** for full documentation on the **version** command. 288 289 **wait** 290 Block until a container stops, then print its exit code 291 See **docker-wait(1)** for full documentation on the **wait** command. 292 293 # STORAGE DRIVER OPTIONS 294 295 Options to storage backend can be specified with **--storage-opt** flags. The 296 only backend which currently takes options is *devicemapper*. Therefore use these 297 flags with **-s=**devicemapper. 298 299 Here is the list of *devicemapper* options: 300 301 #### dm.basesize 302 Specifies the size to use when creating the base device, which limits the size 303 of images and containers. The default value is 10G. Note, thin devices are 304 inherently "sparse", so a 10G device which is mostly empty doesn't use 10 GB 305 of space on the pool. However, the filesystem will use more space for the empty 306 case the larger the device is. **Warning**: This value affects the system-wide 307 "base" empty filesystem that may already be initialized and inherited by pulled 308 images. 309 310 #### dm.loopdatasize 311 Specifies the size to use when creating the loopback file for the "data" 312 device which is used for the thin pool. The default size is 100G. Note that the 313 file is sparse, so it will not initially take up this much space. 314 315 #### dm.loopmetadatasize 316 Specifies the size to use when creating the loopback file for the "metadadata" 317 device which is used for the thin pool. The default size is 2G. Note that the 318 file is sparse, so it will not initially take up this much space. 319 320 #### dm.fs 321 Specifies the filesystem type to use for the base device. The supported 322 options are "ext4" and "xfs". The default is "ext4" 323 324 #### dm.mkfsarg 325 Specifies extra mkfs arguments to be used when creating the base device. 326 327 #### dm.mountopt 328 Specifies extra mount options used when mounting the thin devices. 329 330 #### dm.datadev 331 Specifies a custom blockdevice to use for data for the thin pool. 332 333 If using a block device for device mapper storage, ideally both datadev and 334 metadatadev should be specified to completely avoid using the loopback device. 335 336 #### dm.metadatadev 337 Specifies a custom blockdevice to use for metadata for the thin pool. 338 339 For best performance the metadata should be on a different spindle than the 340 data, or even better on an SSD. 341 342 If setting up a new metadata pool it is required to be valid. This can be 343 achieved by zeroing the first 4k to indicate empty metadata, like this: 344 345 dd if=/dev/zero of=/dev/metadata_dev bs=4096 count=1 346 347 #### dm.blocksize 348 Specifies a custom blocksize to use for the thin pool. The default blocksize 349 is 64K. 350 351 #### dm.blkdiscard 352 Enables or disables the use of blkdiscard when removing devicemapper devices. 353 This is enabled by default (only) if using loopback devices and is required to 354 resparsify the loopback file on image/container removal. 355 356 Disabling this on loopback can lead to *much* faster container removal times, 357 but will prevent the space used in `/var/lib/docker` directory from being returned to 358 the system for other use when containers are removed. 359 360 # EXAMPLES 361 Launching docker daemon with *devicemapper* backend with particular block devices 362 for data and metadata: 363 364 docker -d -s=devicemapper \ 365 --storage-opt dm.datadev=/dev/vdb \ 366 --storage-opt dm.metadatadev=/dev/vdc \ 367 --storage-opt dm.basesize=20G 368 369 # EXEC DRIVER OPTIONS 370 371 Use the **--exec-opt** flags to specify options to the exec-driver. The only 372 driver that accepts this flag is the *native* (libcontainer) driver. As a 373 result, you must also specify **-s=**native for this option to have effect. The 374 following is the only *native* option: 375 376 #### native.cgroupdriver 377 Specifies the management of the container's `cgroups`. You can specify 378 `cgroupfs` or `systemd`. If you specify `systemd` and it is not available, the 379 system uses `cgroupfs`. 380 381 #### Client 382 For specific client examples please see the man page for the specific Docker 383 command. For example: 384 385 man docker-run 386 387 # HISTORY 388 April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.