github.com/gunjan5/docker@v1.8.2/man/docker-create.1.md (about) 1 % DOCKER(1) Docker User Manuals 2 % Docker Community 3 % JUNE 2014 4 # NAME 5 docker-create - Create a new container 6 7 # SYNOPSIS 8 **docker create** 9 [**-a**|**--attach**[=*[]*]] 10 [**--add-host**[=*[]*]] 11 [**--blkio-weight**[=*[BLKIO-WEIGHT]*]] 12 [**-c**|**--cpu-shares**[=*0*]] 13 [**--cap-add**[=*[]*]] 14 [**--cap-drop**[=*[]*]] 15 [**--cgroup-parent**[=*CGROUP-PATH*]] 16 [**--cidfile**[=*CIDFILE*]] 17 [**--cpu-period**[=*0*]] 18 [**--cpu-quota**[=*0*]] 19 [**--cpuset-cpus**[=*CPUSET-CPUS*]] 20 [**--cpuset-mems**[=*CPUSET-MEMS*]] 21 [**--device**[=*[]*]] 22 [**--dns**[=*[]*]] 23 [**--dns-search**[=*[]*]] 24 [**-e**|**--env**[=*[]*]] 25 [**--entrypoint**[=*ENTRYPOINT*]] 26 [**--env-file**[=*[]*]] 27 [**--expose**[=*[]*]] 28 [**--group-add**[=*[]*]] 29 [**-h**|**--hostname**[=*HOSTNAME*]] 30 [**--help**] 31 [**-i**|**--interactive**[=*false*]] 32 [**--ipc**[=*IPC*]] 33 [**-l**|**--label**[=*[]*]] 34 [**--label-file**[=*[]*]] 35 [**--link**[=*[]*]] 36 [**--log-driver**[=*[]*]] 37 [**--log-opt**[=*[]*]] 38 [**--lxc-conf**[=*[]*]] 39 [**-m**|**--memory**[=*MEMORY*]] 40 [**--mac-address**[=*MAC-ADDRESS*]] 41 [**--memory-swap**[=*MEMORY-SWAP*]] 42 [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] 43 [**--name**[=*NAME*]] 44 [**--net**[=*"bridge"*]] 45 [**--oom-kill-disable**[=*false*]] 46 [**-P**|**--publish-all**[=*false*]] 47 [**-p**|**--publish**[=*[]*]] 48 [**--pid**[=*[]*]] 49 [**--privileged**[=*false*]] 50 [**--read-only**[=*false*]] 51 [**--restart**[=*RESTART*]] 52 [**--security-opt**[=*[]*]] 53 [**-t**|**--tty**[=*false*]] 54 [**-u**|**--user**[=*USER*]] 55 [**--ulimit**[=*[]*]] 56 [**--uts**[=*[]*]] 57 [**-v**|**--volume**[=*[]*]] 58 [**--volumes-from**[=*[]*]] 59 [**-w**|**--workdir**[=*WORKDIR*]] 60 IMAGE [COMMAND] [ARG...] 61 62 # DESCRIPTION 63 64 Creates a writeable container layer over the specified image and prepares it for 65 running the specified command. The container ID is then printed to STDOUT. This 66 is similar to **docker run -d** except the container is never started. You can 67 then use the **docker start <container_id>** command to start the container at 68 any point. 69 70 The initial status of the container created with **docker create** is 'created'. 71 72 # OPTIONS 73 **-a**, **--attach**=[] 74 Attach to STDIN, STDOUT or STDERR. 75 76 **--add-host**=[] 77 Add a custom host-to-IP mapping (host:ip) 78 79 **--blkio-weight**=0 80 Block IO weight (relative weight) accepts a weight value between 10 and 1000. 81 82 **-c**, **--cpu-shares**=0 83 CPU shares (relative weight) 84 85 **--cap-add**=[] 86 Add Linux capabilities 87 88 **--cap-drop**=[] 89 Drop Linux capabilities 90 91 **--cidfile**="" 92 Write the container ID to the file 93 94 **--cgroup-parent**="" 95 Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist. 96 97 **--cpu-period**=0 98 Limit the CPU CFS (Completely Fair Scheduler) period 99 100 **--cpuset-cpus**="" 101 CPUs in which to allow execution (0-3, 0,1) 102 103 **--cpuset-mems**="" 104 Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. 105 106 If you have four memory nodes on your system (0-3), use `--cpuset-mems=0,1` 107 then processes in your Docker container will only use memory from the first 108 two memory nodes. 109 110 **-cpu-quota**=0 111 Limit the CPU CFS (Completely Fair Scheduler) quota 112 113 **--device**=[] 114 Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm) 115 116 **--dns-search**=[] 117 Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain) 118 119 **--dns**=[] 120 Set custom DNS servers 121 122 **-e**, **--env**=[] 123 Set environment variables 124 125 **--entrypoint**="" 126 Overwrite the default ENTRYPOINT of the image 127 128 **--env-file**=[] 129 Read in a line delimited file of environment variables 130 131 **--expose**=[] 132 Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host 133 134 **--group-add**=[] 135 Add additional groups to run as 136 137 **-h**, **--hostname**="" 138 Container host name 139 140 **--help** 141 Print usage statement 142 143 **-i**, **--interactive**=*true*|*false* 144 Keep STDIN open even if not attached. The default is *false*. 145 146 **--ipc**="" 147 Default is to create a private IPC namespace (POSIX SysV IPC) for the container 148 'container:<name|id>': reuses another container shared memory, semaphores and message queues 149 'host': use the host shared memory,semaphores and message queues inside the container. Note: the host mode gives the container full access to local shared memory and is therefore considered insecure. 150 151 **-l**, **--label**=[] 152 Adds metadata to a container (e.g., --label=com.example.key=value) 153 154 **--label-file**=[] 155 Read labels from a file. Delimit each label with an EOL. 156 157 **--link**=[] 158 Add link to another container in the form of <name or id>:alias or just 159 <name or id> in which case the alias will match the name. 160 161 **--lxc-conf**=[] 162 (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" 163 164 **--log-driver**="|*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*none*" 165 Logging driver for container. Default is defined by daemon `--log-driver` flag. 166 **Warning**: `docker logs` command works only for `json-file` logging driver. 167 168 **--log-opt**=[] 169 Logging driver specific options. 170 171 **-m**, **--memory**="" 172 Memory limit (format: <number><optional unit>, where unit = b, k, m or g) 173 174 Allows you to constrain the memory available to a container. If the host 175 supports swap memory, then the **-m** memory setting can be larger than physical 176 RAM. If a limit of 0 is specified (not using **-m**), the container's memory is 177 not limited. The actual limit may be rounded up to a multiple of the operating 178 system's page size (the value would be very large, that's millions of trillions). 179 180 **--memory-swap**="" 181 Total memory limit (memory + swap) 182 183 Set `-1` to disable swap (format: <number><optional unit>, where unit = b, k, m or g). 184 This value should always larger than **-m**, so you should always use this with **-m**. 185 186 **--mac-address**="" 187 Container MAC address (e.g. 92:d0:c6:0a:29:33) 188 189 **--name**="" 190 Assign a name to the container 191 192 **--net**="bridge" 193 Set the Network mode for the container 194 'bridge': creates a new network stack for the container on the docker bridge 195 'none': no networking for this container 196 'container:<name|id>': reuses another container network stack 197 'host': use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure. 198 199 **--oom-kill-disable**=*true*|*false* 200 Whether to disable OOM Killer for the container or not. 201 202 **-P**, **--publish-all**=*true*|*false* 203 Publish all exposed ports to random ports on the host interfaces. The default is *false*. 204 205 **-p**, **--publish**=[] 206 Publish a container's port, or a range of ports, to the host 207 format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort 208 Both hostPort and containerPort can be specified as a range of ports. 209 When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range. (e.g., `-p 1234-1236:1234-1236/tcp`) 210 (use 'docker port' to see the actual mapping) 211 212 **--pid**=host 213 Set the PID mode for the container 214 **host**: use the host's PID namespace inside the container. 215 Note: the host mode gives the container full access to local PID and is therefore considered insecure. 216 217 **--uts**=host 218 Set the UTS mode for the container 219 **host**: use the host's UTS namespace inside the container. 220 Note: the host mode gives the container access to changing the host's hostname and is therefore considered insecure. 221 222 **--privileged**=*true*|*false* 223 Give extended privileges to this container. The default is *false*. 224 225 **--read-only**=*true*|*false* 226 Mount the container's root filesystem as read only. 227 228 **--restart**="no" 229 Restart policy to apply when a container exits (no, on-failure[:max-retry], always) 230 231 **--security-opt**=[] 232 Security Options 233 234 **--memory-swappiness**="" 235 Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. 236 237 **-t**, **--tty**=*true*|*false* 238 Allocate a pseudo-TTY. The default is *false*. 239 240 **-u**, **--user**="" 241 Username or UID 242 243 **--ulimit**=[] 244 Ulimit options 245 246 **-v**, **--volume**=[] 247 Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container) 248 249 **--volumes-from**=[] 250 Mount volumes from the specified container(s) 251 252 **-w**, **--workdir**="" 253 Working directory inside the container 254 255 # HISTORY 256 August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 257 September 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 258 November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>