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