diff --git a/compose/compose-file/compose-file-v2.md b/compose/compose-file/compose-file-v2.md index 825b57ddc5..a21b40a5d7 100644 --- a/compose/compose-file/compose-file-v2.md +++ b/compose/compose-file/compose-file-v2.md @@ -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 diff --git a/compose/compose-file/index.md b/compose/compose-file/index.md index 0a1c9fdd27..c204cb945d 100644 --- a/compose/compose-file/index.md +++ b/compose/compose-file/index.md @@ -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 diff --git a/test.md b/test.md index c4f9e6b695..391611b335 100644 --- a/test.md +++ b/test.md @@ -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) + - an HTML link - an HTML link that opens in a new window @@ -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