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