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