github.com/sbward/docker@v1.4.2-0.20150114010528-c9dab702bed3/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**[=*CPUSET*]] 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 [**--link**[=*[]*]] 28 [**--lxc-conf**[=*[]*]] 29 [**-m**|**--memory**[=*MEMORY*]] 30 [**--mac-address**[=*MAC-ADDRESS*]] 31 [**--name**[=*NAME*]] 32 [**--net**[=*"bridge"*]] 33 [**-P**|**--publish-all**[=*false*]] 34 [**-p**|**--publish**[=*[]*]] 35 [**--pid**[=*[]*]] 36 [**--privileged**[=*false*]] 37 [**--restart**[=*RESTART*]] 38 [**--security-opt**[=*[]*]] 39 [**-t**|**--tty**[=*false*]] 40 [**-u**|**--user**[=*USER*]] 41 [**-v**|**--volume**[=*[]*]] 42 [**--volumes-from**[=*[]*]] 43 [**-w**|**--workdir**[=*WORKDIR*]] 44 IMAGE [COMMAND] [ARG...] 45 46 # OPTIONS 47 **-a**, **--attach**=[] 48 Attach to STDIN, STDOUT or STDERR. 49 50 **--add-host**=[] 51 Add a custom host-to-IP mapping (host:ip) 52 53 **-c**, **--cpu-shares**=0 54 CPU shares (relative weight) 55 56 **--cap-add**=[] 57 Add Linux capabilities 58 59 **--cap-drop**=[] 60 Drop Linux capabilities 61 62 **--cidfile**="" 63 Write the container ID to the file 64 65 **--cpuset**="" 66 CPUs in which to allow execution (0-3, 0,1) 67 68 **--device**=[] 69 Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm) 70 71 **--dns-search**=[] 72 Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain) 73 74 **--dns**=[] 75 Set custom DNS servers 76 77 **-e**, **--env**=[] 78 Set environment variables 79 80 **--entrypoint**="" 81 Overwrite the default ENTRYPOINT of the image 82 83 **--env-file**=[] 84 Read in a line delimited file of environment variables 85 86 **--expose**=[] 87 Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host 88 89 **-h**, **--hostname**="" 90 Container host name 91 92 **--help** 93 Print usage statement 94 95 **-i**, **--interactive**=*true*|*false* 96 Keep STDIN open even if not attached. The default is *false*. 97 98 **--ipc**="" 99 Default is to create a private IPC namespace (POSIX SysV IPC) for the container 100 'container:<name|id>': reuses another container shared memory, semaphores and message queues 101 '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. 102 103 **--link**=[] 104 Add link to another container in the form of name:alias 105 106 **--lxc-conf**=[] 107 (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1" 108 109 **-m**, **--memory**="" 110 Memory limit (format: <number><optional unit>, where unit = b, k, m or g) 111 112 **--mac-address**="" 113 Container MAC address (e.g. 92:d0:c6:0a:29:33) 114 115 **--name**="" 116 Assign a name to the container 117 118 **--net**="bridge" 119 Set the Network mode for the container 120 'bridge': creates a new network stack for the container on the docker bridge 121 'none': no networking for this container 122 'container:<name|id>': reuses another container network stack 123 '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. 124 125 **-P**, **--publish-all**=*true*|*false* 126 Publish all exposed ports to random ports on the host interfaces. The default is *false*. 127 128 **-p**, **--publish**=[] 129 Publish a container's port, or a range of ports, to the host 130 format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort 131 Both hostPort and containerPort can be specified as a range of ports. 132 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`) 133 (use 'docker port' to see the actual mapping) 134 135 **--pid**=host 136 Set the PID mode for the container 137 **host**: use the host's PID namespace inside the container. 138 Note: the host mode gives the container full access to local PID and is therefore considered insecure. 139 140 **--privileged**=*true*|*false* 141 Give extended privileges to this container. The default is *false*. 142 143 **--restart**="" 144 Restart policy to apply when a container exits (no, on-failure[:max-retry], always) 145 146 **--security-opt**=[] 147 Security Options 148 149 **-t**, **--tty**=*true*|*false* 150 Allocate a pseudo-TTY. The default is *false*. 151 152 **-u**, **--user**="" 153 Username or UID 154 155 **-v**, **--volume**=[] 156 Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container) 157 158 **--volumes-from**=[] 159 Mount volumes from the specified container(s) 160 161 **-w**, **--workdir**="" 162 Working directory inside the container 163 164 # HISTORY 165 August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 166 September 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 167 November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>