diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 03c593f600..f3997a0c77 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1372,6 +1372,8 @@ _docker_run() { --cpuset-mems --cpu-shares --device + --device-read-bps + --device-write-bps --dns --dns-opt --dns-search diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index cebaf07bdd..b29d7a587b 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -468,6 +468,8 @@ __docker_subcommand() { "($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)*--device=[Add a host device to the container]:device:_files" + "($help)*--device-read-bps=[Limit the read rate (bytes per second) from a device]:device:IO rate: " + "($help)*--device-write-bps=[Limit the write rate (bytes per second) to a device]:device:IO rate: " "($help)*--dns=[Set custom DNS servers]:DNS server: " "($help)*--dns-opt=[Set custom DNS options]:DNS option: " "($help)*--dns-search=[Set custom DNS search domains]:DNS domains: " diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index 982d3b6a4e..06e047f4aa 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -30,6 +30,8 @@ Creates a new container. --cpuset-cpus="" CPUs in which to allow execution (0-3, 0,1) --cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1) --device=[] Add a host device to the container + --device-read-bps=[] Limit read rate (bytes per second) from a device (e.g., --device-read-bps=/dev/sda:1mb) + --device-write-bps=[] Limit write rate (bytes per second) to a device (e.g., --device-write-bps=/dev/sda:1mb) --disable-content-trust=true Skip image verification --dns=[] Set custom DNS servers --dns-opt=[] Set custom DNS options diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 61f0480474..5794b65ba0 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -29,6 +29,8 @@ parent = "smn_cli" --cpuset-mems="" Memory nodes (MEMs) in which to allow execution (0-3, 0,1) -d, --detach=false Run container in background and print container ID --device=[] Add a host device to the container + --device-read-bps=[] Limit read rate (bytes per second) from a device (e.g., --device-read-bps=/dev/sda:1mb) + --device-write-bps=[] Limit write rate (bytes per second) to a device (e.g., --device-write-bps=/dev/sda:1mb) --disable-content-trust=true Skip image verification --dns=[] Set custom DNS servers --dns-opt=[] Set custom DNS options diff --git a/docs/reference/run.md b/docs/reference/run.md index 80961f91c5..53923f9afa 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -624,6 +624,10 @@ container: | `--cpu-quota=0` | Limit the CPU CFS (Completely Fair Scheduler) quota | | `--blkio-weight=0` | Block IO weight (relative weight) accepts a weight value between 10 and 1000. | | `--blkio-weight-device=""` | Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) | +| `--device-read-bps="" ` | Limit read rate from a device (format: `:[]`. | +| | Number is a positive integer. Unit can be one of kb, mb, or gb. | +| `--device-write-bps="" ` | Limit write rate to a device (format: `:[]`. | +| | Number is a positive integer. Unit can be one of kb, mb, or gb. | | `--oom-kill-disable=false` | Whether to disable OOM Killer for the container or not. | | `--memory-swappiness="" ` | Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. | | `--shm-size="" ` | Size of `/dev/shm`. The format is ``. `number` must be greater than `0`. | @@ -978,6 +982,18 @@ $ docker run -it \ --blkio-weight-device "/dev/sda:200" \ ubuntu +The `--device-read-bps` flag can limit read rate from a device. +For example, the command creates a container and limits theread rate to `1mb` per second from `/dev/sda`: + + $ docker run -ti --device-read-bps /dev/sda:1mb ubuntu + +The `--device-write-bps` flag can limit write rate to a device. +For example, the command creates a container and limits write rate to `1mb` per second to `/dev/sda`: + + $ docker run -ti --device-write-bps /dev/sda:1mb ubuntu + +Both flags take limits in the `:[unit]` format. Both read and write rates must be a positive integer. You can specify the rate in `kb` (kilobytes), `mb` (megabytes), or `gb` (gigabytes). + ## Additional groups --group-add: Add Linux capabilities diff --git a/man/docker-create.1.md b/man/docker-create.1.md index 362eef7474..8212c6bd82 100644 --- a/man/docker-create.1.md +++ b/man/docker-create.1.md @@ -20,6 +20,8 @@ docker-create - Create a new container [**--cpuset-cpus**[=*CPUSET-CPUS*]] [**--cpuset-mems**[=*CPUSET-MEMS*]] [**--device**[=*[]*]] +[**--device-read-bps**[=*[]*]] +[**--device-write-bps**[=*[]*]] [**--dns**[=*[]*]] [**--dns-search**[=*[]*]] [**--dns-opt**[=*[]*]] @@ -125,6 +127,12 @@ two memory nodes. **--device**=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm) +**--device-read-bps**=[] + Limit read rate (bytes per second) from a device (e.g. --device-read-bps=/dev/sda:1mb) + +**--device-write-bps**=[] + Limit write rate (bytes per second) to a device (e.g. --device-write-bps=/dev/sda:1mb) + **--dns**=[] Set custom DNS servers diff --git a/man/docker-run.1.md b/man/docker-run.1.md index 5ee9dea044..83c901006c 100644 --- a/man/docker-run.1.md +++ b/man/docker-run.1.md @@ -21,6 +21,8 @@ docker-run - Run a command in a new container [**--cpuset-mems**[=*CPUSET-MEMS*]] [**-d**|**--detach**[=*false*]] [**--device**[=*[]*]] +[**--device-read-bps**[=*[]*]] +[**--device-write-bps**[=*[]*]] [**--dns**[=*[]*]] [**--dns-opt**[=*[]*]] [**--dns-search**[=*[]*]] @@ -192,6 +194,12 @@ stopping the process by pressing the keys CTRL-P CTRL-Q. **--device**=[] Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm) +**--device-read-bps**=[] + Limit read rate from a device (e.g. --device-read-bps=/dev/sda:1mb) + +**--device-write-bps**=[] + Limit write rate to a device (e.g. --device-write-bps=/dev/sda:1mb) + **--dns-search**=[] Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain)