From 56ba763d4859e22e8b2ab85d018939e37fa6df44 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Tue, 24 Mar 2015 18:48:08 +0800 Subject: [PATCH] add cpuset and examples to run.md Signed-off-by: Qiang Huang Upstream-commit: 7618ff84f88afab6d269a7d62defd7088dd3c121 Component: cli --- components/cli/docs/sources/reference/run.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/components/cli/docs/sources/reference/run.md b/components/cli/docs/sources/reference/run.md index dc7bdcff84..3023da69c9 100644 --- a/components/cli/docs/sources/reference/run.md +++ b/components/cli/docs/sources/reference/run.md @@ -449,14 +449,15 @@ Note: You would have to write policy defining a `svirt_apache_t` type. -## Runtime constraints on CPU and memory +## Runtime constraints on resources The operator can also adjust the performance parameters of the container: - -m="": Memory limit (format: , where unit = b, k, m or g) + -m, --memory="": Memory limit (format: , where unit = b, k, m or g) -memory-swap="": Total memory limit (memory + swap, format: , where unit = b, k, m or g) -c, --cpu-shares=0: CPU shares (relative weight) + --cpuset-cpus="": CPUs in which to allow execution (0-3, 0,1) ### Memory constraints @@ -568,6 +569,20 @@ division of CPU shares: 101 {C1} 1 100% of CPU1 102 {C1} 2 100% of CPU2 +### Cpuset constraint + +We can set cpus in which to allow execution for containers. + +Examples: + + $ sudo docker run -ti --cpuset-cpus="1,3" ubuntu:14.04 /bin/bash + +This means processes in container can be executed on cpu 1 and cpu 3. + + $ sudo docker run -ti --cpuset-cpus="0-2" ubuntu:14.04 /bin/bash + +This means processes in container can be executed on cpu 0, cpu 1 and cpu 2. + ## Runtime privilege, Linux capabilities, and LXC configuration --cap-add: Add Linux capabilities