add needed clarity for
1) using STDIN to pass build context
2) --cpu-shares flag use
also a few typos
Signed-off-by: Sally O'Malley <somalley@redhat.com>
| ... | ... |
@@ -40,8 +40,9 @@ The Docker CLI reports "Sending build context to Docker daemon" when the context |
| 40 | 40 |
the daemon. |
| 41 | 41 |
|
| 42 | 42 |
When the URL to a tarball archive or to a single Dockerfile is given, no context is sent from |
| 43 |
-the client to the Docker daemon. When a Git repository is set as the **URL**, the repository is |
|
| 44 |
-cloned locally and then sent as the context. |
|
| 43 |
+the client to the Docker daemon. In this case, the Dockerfile at the root of the archive and |
|
| 44 |
+the rest of the archive will get used as the context of the build. When a Git repository is |
|
| 45 |
+set as the **URL**, the repository is cloned locally and then sent as the context. |
|
| 45 | 46 |
|
| 46 | 47 |
# OPTIONS |
| 47 | 48 |
**-f**, **--file**=*PATH/Dockerfile* |
| ... | ... |
@@ -93,32 +94,50 @@ cloned locally and then sent as the context. |
| 93 | 93 |
**-c**, **--cpu-shares**=*0* |
| 94 | 94 |
CPU shares (relative weight). |
| 95 | 95 |
|
| 96 |
- By default, all containers get the same proportion of CPU cycles. You can |
|
| 97 |
- change this proportion by adjusting the container's CPU share weighting |
|
| 98 |
- relative to the weighting of all other running containers. |
|
| 96 |
+ By default, all containers get the same proportion of CPU cycles. |
|
| 97 |
+ CPU shares is a 'relative weight', relative to the default setting of 1024. |
|
| 98 |
+ This default value is defined here: |
|
| 99 |
+ ``` |
|
| 100 |
+ cat /sys/fs/cgroup/cpu/cpu.shares |
|
| 101 |
+ 1024 |
|
| 102 |
+ ``` |
|
| 103 |
+ You can change this proportion by adjusting the container's CPU share |
|
| 104 |
+ weighting relative to the weighting of all other running containers. |
|
| 99 | 105 |
|
| 100 |
- To modify the proportion from the default of 1024, use the **-c** or |
|
| 101 |
- **--cpu-shares** flag to set the weighting to 2 or higher. |
|
| 106 |
+ To modify the proportion from the default of 1024, use the **--cpu-shares** |
|
| 107 |
+ flag to set the weighting to 2 or higher. |
|
| 108 |
+ |
|
| 109 |
+ Container CPU share Flag |
|
| 110 |
+ {C0} 60% of CPU --cpu-shares=614 (614 is 60% of 1024)
|
|
| 111 |
+ {C1} 40% of CPU --cpu-shares=410 (410 is 40% of 1024)
|
|
| 102 | 112 |
|
| 103 | 113 |
The proportion is only applied when CPU-intensive processes are running. |
| 104 | 114 |
When tasks in one container are idle, the other containers can use the |
| 105 | 115 |
left-over CPU time. The actual amount of CPU time used varies depending on |
| 106 | 116 |
the number of containers running on the system. |
| 107 | 117 |
|
| 108 |
- For example, consider three containers, one has a cpu-share of 1024 and |
|
| 109 |
- two others have a cpu-share setting of 512. When processes in all three |
|
| 118 |
+ For example, consider three containers, where one has **--cpu-shares=1024** and |
|
| 119 |
+ two others have **--cpu-shares=512**. When processes in all three |
|
| 110 | 120 |
containers attempt to use 100% of CPU, the first container would receive |
| 111 |
- 50% of the total CPU time. If you add a fourth container with a cpu-share |
|
| 112 |
- of 1024, the first container only gets 33% of the CPU. The remaining containers |
|
| 121 |
+ 50% of the total CPU time. If you add a fourth container with **--cpu-shares=1024**, |
|
| 122 |
+ the first container only gets 33% of the CPU. The remaining containers |
|
| 113 | 123 |
receive 16.5%, 16.5% and 33% of the CPU. |
| 114 | 124 |
|
| 125 |
+ |
|
| 126 |
+ Container CPU share Flag CPU time |
|
| 127 |
+ {C0} 100% --cpu-shares=1024 33%
|
|
| 128 |
+ {C1} 50% --cpu-shares=512 16.5%
|
|
| 129 |
+ {C2} 50% --cpu-shares=512 16.5%
|
|
| 130 |
+ {C4} 100% --cpu-shares=1024 33%
|
|
| 131 |
+ |
|
| 132 |
+ |
|
| 115 | 133 |
On a multi-core system, the shares of CPU time are distributed across the CPU |
| 116 | 134 |
cores. Even if a container is limited to less than 100% of CPU time, it can |
| 117 | 135 |
use 100% of each individual CPU core. |
| 118 | 136 |
|
| 119 | 137 |
For example, consider a system with more than three cores. If you start one |
| 120 |
- container **{C0}** with **-c=512** running one process, and another container
|
|
| 121 |
- **{C1}** with **-c=1024** running two processes, this can result in the following
|
|
| 138 |
+ container **{C0}** with **--cpu-shares=512** running one process, and another container
|
|
| 139 |
+ **{C1}** with **--cpu-shares=1024** running two processes, this can result in the following
|
|
| 122 | 140 |
division of CPU shares: |
| 123 | 141 |
|
| 124 | 142 |
PID container CPU CPU share |
| ... | ... |
@@ -142,7 +161,7 @@ kernel to restrict the container's CPU usage to the quota you specify. |
| 142 | 142 |
CPUs in which to allow execution (0-3, 0,1). |
| 143 | 143 |
|
| 144 | 144 |
**--cpuset-mems**=*CPUSET-MEMS* |
| 145 |
- Memory nodes (MEMs) in which to allow execution (-1-3, 0,1). Only effective on |
|
| 145 |
+ Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on |
|
| 146 | 146 |
NUMA systems. |
| 147 | 147 |
|
| 148 | 148 |
For example, if you have four memory nodes on your system (0-3), use `--cpuset-mems=0,1` |
| ... | ... |
@@ -204,16 +223,16 @@ name, and tag (where the tag in this context means the qualifier after |
| 204 | 204 |
the ":"). In this example we build a JBoss image for the Fedora repository |
| 205 | 205 |
and give it the version 1.0: |
| 206 | 206 |
|
| 207 |
- docker build -t fedora/jboss:1.0 |
|
| 207 |
+ docker build -t fedora/jboss:1.0 . |
|
| 208 | 208 |
|
| 209 | 209 |
The next example is for the "whenry" user repository and uses Fedora and |
| 210 | 210 |
JBoss and gives it the version 2.1 : |
| 211 | 211 |
|
| 212 |
- docker build -t whenry/fedora-jboss:v2.1 |
|
| 212 |
+ docker build -t whenry/fedora-jboss:v2.1 . |
|
| 213 | 213 |
|
| 214 | 214 |
If you do not provide a version tag then Docker will assign `latest`: |
| 215 | 215 |
|
| 216 |
- docker build -t whenry/fedora-jboss |
|
| 216 |
+ docker build -t whenry/fedora-jboss . |
|
| 217 | 217 |
|
| 218 | 218 |
When you list the images, the image above will have the tag `latest`. |
| 219 | 219 |
|
| ... | ... |
@@ -229,16 +248,17 @@ as context. The Dockerfile at the root of the repository is used as |
| 229 | 229 |
Dockerfile. This only works if the GitHub repository is a dedicated |
| 230 | 230 |
repository. |
| 231 | 231 |
|
| 232 |
- docker build github.com/scollier/Fedora-Dockerfiles/tree/master/apache |
|
| 232 |
+ docker build github.com/scollier/purpletest |
|
| 233 | 233 |
|
| 234 | 234 |
Note: You can set an arbitrary Git repository via the `git://` schema. |
| 235 | 235 |
|
| 236 | 236 |
## Building an image using a URL to a tarball'ed context |
| 237 | 237 |
|
| 238 | 238 |
This will send the URL itself to the Docker daemon. The daemon will fetch the |
| 239 |
-tarball archive, decompress it and use its contents as the build context. If you |
|
| 240 |
-pass an *-f PATH/Dockerfile* option as well, the system will look for that file |
|
| 241 |
-inside the contents of the tarball. |
|
| 239 |
+tarball archive, decompress it and use its contents as the build context. The |
|
| 240 |
+Dockerfile at the root of the archive and the rest of the archive will get used |
|
| 241 |
+as the context of the build. If you pass an **-f PATH/Dockerfile** option as well, |
|
| 242 |
+the system will look for that file inside the contents of the tarball. |
|
| 242 | 243 |
|
| 243 | 244 |
docker build -f dev/Dockerfile https://10.10.10.1/docker/context.tar.gz |
| 244 | 245 |
|