More info on resource constraints in Compose v3 and v2 (#4651)

* added more info about resource constraints to Compose docs

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>

* fixed link in Compose docs, added instructions in test for adding custom target link link IDs

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>

* fixed links

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
This commit is contained in:
Victoria Bialas 2017-09-18 16:02:05 -07:00 committed by GitHub
parent 4641ccfc6b
commit 02fc66fde8
3 changed files with 37 additions and 3 deletions

View File

@ -1088,6 +1088,8 @@ then read-write will be used.
- restart: always
- restart: on-failure
{: id="cpu-and-other-resources"}
### cpu_count, cpu_percent, cpu\_shares, cpu\_quota, cpus, cpuset, domainname, hostname, ipc, mac\_address, mem\_limit, memswap\_limit, mem\_swappiness, mem\_reservation, oom_score_adj, privileged, read\_only, shm\_size, stdin\_open, tty, user, working\_dir
Each of these is a single value, analogous to its

View File

@ -46,7 +46,7 @@ services:
delay: 10s
restart_policy:
condition: on-failure
db:
image: postgres:9.4
volumes:
@ -650,8 +650,12 @@ Configures resource constraints. This replaces the older resource constraint
options in Compose files prior to version 3 (`cpu_shares`, `cpu_quota`,
`cpuset`, `mem_limit`, `memswap_limit`, `mem_swappiness`).
Each of these is a single value, analogous to its
[docker service create](/engine/reference/commandline/service_create.md) counterpart.
Each of these is a single value, analogous to its [docker service
create](/engine/reference/commandline/service_create.md) counterpart.
In this general example, the `redis` service is constrained to use no more than
50M of memory and `0.001` (0.1%) of available processing time (CPU), and has
`20M` of memory and `0.0001` CPU time reserved (as always available to it).
```none
version: '3'
@ -668,6 +672,20 @@ services:
memory: 20M
```
The topics below describe available options to set resource constraints on
services or containers in a swarm.
> Looking for options to set resources on non swarm mode containers?
>
> The options described here are specific to the
`deploy` key and swarm mode. If you want to set resource constraints
on non swarm deployments, use
[Compose file format version 2 CPU, memory, and other resource
options](compose-file-v2.md#cpu-and-other-resources).
If you have further questions, please refer to the discussion on the GitHub
issue [docker/compose/4513](https://github.com/docker/compose/issues/4513){: target="_blank" class="_"}.
{: .important}
##### Out Of Memory Exceptions (OOME)
If your services or containers attempt to use more memory than the system has

14
test.md
View File

@ -75,6 +75,8 @@ https://github.com/docker/docker.github.io/tree/master/docker-cloud/images
- [a markdown link that opens in a new window](https://docker.com/){: target="_blank" class="_" }
(the `class="_"` trick prevents Atom from italicizing the whole rest of the file until it encounters another underscore.)
- [a markdown link to a custom target ID](#custom-target-id)
- <a href="https://docker.com/">an HTML link</a>
- <a href="https://docker.com/" target="_blank" class="_">an HTML link that opens in a new window</a>
@ -85,6 +87,18 @@ https://github.com/docker/docker.github.io/tree/master/docker-cloud/images
(you can also specify `org=foo` to use a Github organization other than Docker).
{: id="custom-target-id"}
#### Using a custom target ID
This topic has a custom target ID above its heading that can be used to link to
it, in addtion to, or instead of, the default concatenated heading style.
You can use custom targets to link to headings or even paragraphs.
An example of a custom target ID in the documentation is the topic on
[Compose file version 2 topic on CPU and other resources](/compose/compose-file/compose-file-v2.md#cpu-and-other-resources).
It has a long heading that breaks the normal markdown linking mechanism,
so we added a custom ID above the target heading.
### Images