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