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