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