diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 851f30d1e6..2fbd5a82cf 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1355,6 +1355,7 @@ _docker_run() { --add-host --attach -a --blkio-weight + --blkio-weight-device --cap-add --cap-drop --cgroup-parent diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index 4ae3f140fd..6656161d7d 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -418,6 +418,7 @@ __docker_subcommand() { "($help -a --attach)"{-a=,--attach=}"[Attach to stdin, stdout or stderr]:device:(STDIN STDOUT STDERR)" "($help)*--add-host=[Add a custom host-to-IP mapping]:host\:ip mapping: " "($help)--blkio-weight=[Block IO (relative weight), between 10 and 1000]:Block IO weight:(10 100 500 1000)" + "($help)--blkio-weight-device=-[Block IO (relative device weight)]:device:Block IO weight: " "($help)*--cap-add=[Add Linux capabilities]:capability: " "($help)*--cap-drop=[Drop Linux capabilities]:capability: " "($help)--cidfile=[Write the container ID to the file]:CID file:_files" diff --git a/docs/reference/commandline/create.md b/docs/reference/commandline/create.md index 38ad091e7e..9c4b19bd8c 100644 --- a/docs/reference/commandline/create.md +++ b/docs/reference/commandline/create.md @@ -19,6 +19,7 @@ Creates a new container. -a, --attach=[] Attach to STDIN, STDOUT or STDERR --add-host=[] Add a custom host-to-IP mapping (host:ip) --blkio-weight=0 Block IO weight (relative weight) + --blkio-weight-device="" Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) --cpu-shares=0 CPU shares (relative weight) --cap-add=[] Add Linux capabilities --cap-drop=[] Drop Linux capabilities diff --git a/docs/reference/commandline/run.md b/docs/reference/commandline/run.md index 76446ca84b..3ad93f2fa3 100644 --- a/docs/reference/commandline/run.md +++ b/docs/reference/commandline/run.md @@ -17,6 +17,7 @@ parent = "smn_cli" -a, --attach=[] Attach to STDIN, STDOUT or STDERR --add-host=[] Add a custom host-to-IP mapping (host:ip) --blkio-weight=0 Block IO weight (relative weight) + --blkio-weight-device="" Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`) --cpu-shares=0 CPU shares (relative weight) --cap-add=[] Add Linux capabilities --cap-drop=[] Drop Linux capabilities diff --git a/docs/reference/run.md b/docs/reference/run.md index eecc4a5765..5ea79d4b28 100644 --- a/docs/reference/run.md +++ b/docs/reference/run.md @@ -623,6 +623,7 @@ container: | `--cpuset-mems=""` | Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. | | `--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`) | | `--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. | @@ -937,6 +938,9 @@ By default, all containers get the same proportion of block IO bandwidth container's blkio weight relative to the weighting of all other running containers using the `--blkio-weight` flag. +> **Note:** The blkio weight setting is only available for direct IO. Buffered IO +> is not currently supported. + The `--blkio-weight` flag can set the weighting to a value between 10 to 1000. For example, the commands below create two containers with different blkio weight: @@ -951,8 +955,24 @@ If you do block IO in the two containers at the same time, by, for example: You'll find that the proportion of time is the same as the proportion of blkio weights of the two containers. -> **Note:** The blkio weight setting is only available for direct IO. Buffered IO -> is not currently supported. +The `--blkio-weight-device="DEVICE_NAME:WEIGHT"` flag sets a specific device weight. +The `DEVICE_NAME:WEIGHT` is a string containing a colon-separated device name and weight. +For example, to set `/dev/sda` device weight to `200`: + +$ docker run -it \ + --blkio-weight-device "/dev/sda:200" \ + ubuntu + +If you specify both the `--blkio-weight` and `--blkio-weight-device`, Docker +uses the `--blkio-weight` as the default weight and uses `--blkio-weight-device` +to override this default with a new value on a specific device. +The following example uses a default weight of `300` and overrides this default +on `/dev/sda` setting that weight to `200`: + +$ docker run -it \ + --blkio-weight 300 \ + --blkio-weight-device "/dev/sda:200" \ + ubuntu ## Additional groups --group-add: Add Linux capabilities diff --git a/man/docker-create.1.md b/man/docker-create.1.md index 939baf91ae..b919234073 100644 --- a/man/docker-create.1.md +++ b/man/docker-create.1.md @@ -9,6 +9,7 @@ docker-create - Create a new container [**-a**|**--attach**[=*[]*]] [**--add-host**[=*[]*]] [**--blkio-weight**[=*[BLKIO-WEIGHT]*]] +[**--blkio-weight-device**[=*[]*]] [**--cpu-shares**[=*0*]] [**--cap-add**[=*[]*]] [**--cap-drop**[=*[]*]] @@ -82,6 +83,9 @@ The initial status of the container created with **docker create** is 'created'. **--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`). + **--cpu-shares**=*0* CPU shares (relative weight) diff --git a/man/docker-run.1.md b/man/docker-run.1.md index 76d207a760..72475b098a 100644 --- a/man/docker-run.1.md +++ b/man/docker-run.1.md @@ -9,6 +9,7 @@ docker-run - Run a command in a new container [**-a**|**--attach**[=*[]*]] [**--add-host**[=*[]*]] [**--blkio-weight**[=*[BLKIO-WEIGHT]*]] +[**--blkio-weight-device**[=*[]*]] [**--cpu-shares**[=*0*]] [**--cap-add**[=*[]*]] [**--cap-drop**[=*[]*]] @@ -99,6 +100,9 @@ option can be set multiple times. **--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`). + **--cpu-shares**=*0* CPU shares (relative weight) @@ -755,6 +759,13 @@ Note: You would have to write policy defining a `svirt_apache_t` type. +## Setting device weight + +If you want to set `/dev/sda` device weight to `200`, you can specify the device +weight by `--blkio-weight-device` flag. Use the following command: + + # docker run -it --blkio-weight-device "/dev/sda:200" ubuntu + # HISTORY April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.