|
@@ -417,7 +417,7 @@ Creates a new container.
|
|
|
--cap-drop=[] Drop Linux capabilities
|
|
|
--cidfile="" Write the container ID to the file
|
|
|
--cpuset="" CPUs in which to allow execution (0-3, 0,1)
|
|
|
- --device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc)
|
|
|
+ --device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
|
|
|
--dns=[] Set custom DNS servers
|
|
|
--dns-search=[] Set custom DNS search domains
|
|
|
-e, --env=[] Set environment variables
|
|
@@ -457,6 +457,8 @@ container at any point.
|
|
|
This is useful when you want to set up a container configuration ahead
|
|
|
of time so that it is ready to start when you need it.
|
|
|
|
|
|
+Please see the [run command](#run) section for more details.
|
|
|
+
|
|
|
#### Example
|
|
|
|
|
|
$ sudo docker create -t -i fedora bash
|
|
@@ -1115,7 +1117,7 @@ removed before the image is removed.
|
|
|
--cidfile="" Write the container ID to the file
|
|
|
--cpuset="" CPUs in which to allow execution (0-3, 0,1)
|
|
|
-d, --detach=false Detached mode: run the container in the background and print the new container ID
|
|
|
- --device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc)
|
|
|
+ --device=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
|
|
|
--dns=[] Set custom DNS servers
|
|
|
--dns-search=[] Set custom DNS search domains
|
|
|
-e, --env=[] Set environment variables
|
|
@@ -1324,8 +1326,31 @@ option enables that. For example, a specific block storage device or loop
|
|
|
device or audio device can be added to an otherwise unprivileged container
|
|
|
(without the `--privileged` flag) and have the application directly access it.
|
|
|
|
|
|
+By default, the container will be able to `read`, `write` and `mknod` these devices.
|
|
|
+This can be overridden using a third `:rwm` set of options to each `--device`
|
|
|
+flag:
|
|
|
+
|
|
|
+
|
|
|
+```
|
|
|
+ $ sudo docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc
|
|
|
+
|
|
|
+ Command (m for help): q
|
|
|
+ $ sudo docker run --device=/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk /dev/xvdc
|
|
|
+ You will not be able to write the partition table.
|
|
|
+
|
|
|
+ Command (m for help): q
|
|
|
+
|
|
|
+ $ sudo docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc
|
|
|
+
|
|
|
+ Command (m for help): q
|
|
|
+
|
|
|
+ $ sudo docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk /dev/xvdc
|
|
|
+ fdisk: unable to open /dev/xvdc: Operation not permitted
|
|
|
+```
|
|
|
+
|
|
|
**Note:**
|
|
|
-> `--device` cannot be safely used with ephemeral devices. Block devices that may be removed should not be added to untrusted containers with `--device`.
|
|
|
+> `--device` cannot be safely used with ephemeral devices. Block devices that
|
|
|
+> may be removed should not be added to untrusted containers with `--device`.
|
|
|
|
|
|
**A complete example:**
|
|
|
|