Allow adding rules to cgroup devices.allow on container create/run

This introduce a new `--device-cgroup-rule` flag that allow a user to
add one or more entry to the container cgroup device `devices.allow`

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 1756af6fafabd9197feb56c0324e49dd7d30b11f
Component: engine
This commit is contained in:
Kenfe-Mickael Laventure
2017-01-26 07:20:45 -08:00
parent 22f59a404a
commit b35799c15f
10 changed files with 92 additions and 0 deletions
+11
View File
@@ -27,6 +27,7 @@ docker-run - Run a command in a new container
[**-d**|**--detach**]
[**--detach-keys**[=*[]*]]
[**--device**[=*[]*]]
[**--device-cgroup-rule**[=*[]*]]
[**--device-read-bps**[=*[]*]]
[**--device-read-iops**[=*[]*]]
[**--device-write-bps**[=*[]*]]
@@ -246,6 +247,16 @@ See **config-json(5)** for documentation on using a configuration file.
**--device**=[]
Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
**--device-cgroup-rule**=[]
Add a rule to the cgroup allowed devices list.
The rule is expected to be in the format specified in the Linux kernel documentation (Documentation/cgroup-v1/devices.txt):
- type: `a` (all), `c` (char) or `b` (block)
- major and minor: either a number or `*` for all
- permission: a composition of `r` (read), `w` (write) and `m` (mknod)
Example: `c 1:3 mr`: allow for character device with major `1` and minor `3` to be created (`m`) and read (`r`)
**--device-read-bps**=[]
Limit read rate from a device (e.g. --device-read-bps=/dev/sda:1mb)