Browse code

Merge pull request #9318 from shishir-a412ed/doc-cpu-share

Enhanced description for 'docker run' command, -c/--cpu-shares flag

Michael Crosby authored on 2014/12/10 10:21:09
Showing 1 changed files
... ...
@@ -302,6 +302,19 @@ get the same proportion of CPU cycles, but you can tell the kernel to
302 302
 give more shares of CPU time to one or more containers when you start
303 303
 them via Docker.
304 304
 
305
+The flag `-c` or `--cpu-shares` with value 0 indicates that the running
306
+container has access to all 1024 (default) CPU shares. However, this value
307
+can be modified to run a container with a different priority or different
308
+proportion of CPU cycles.
309
+
310
+E.g., If we start three {C0, C1, C2} containers with default values
311
+(`-c` OR `--cpu-shares` = 0) and one {C3} with (`-c` or `--cpu-shares`=512)
312
+then C0, C1, and C2 would have access to 100% CPU shares (1024) and C3 would
313
+only have access to 50% CPU shares (512). In the context of a time-sliced OS
314
+with time quantum set as 100 milliseconds, containers C0, C1, and C2 will run
315
+for full-time quantum, and container C3 will run for half-time quantum i.e 50
316
+milliseconds.
317
+
305 318
 ## Runtime privilege, Linux capabilities, and LXC configuration
306 319
 
307 320
     --cap-add: Add Linux capabilities