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