From 5ef2091f512271bd5f2d8e9c301afd3654297e9e Mon Sep 17 00:00:00 2001 From: JMARyA Date: Mon, 15 Jul 2024 13:37:50 +0200 Subject: [PATCH] update docker compose --- technology/tools/Docker Compose.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/technology/tools/Docker Compose.md b/technology/tools/Docker Compose.md index 396a839..feb1263 100644 --- a/technology/tools/Docker Compose.md +++ b/technology/tools/Docker Compose.md @@ -2,6 +2,7 @@ obj: application source: https://docs.docker.com/compose repo: https://github.com/docker/compose +rev: 2024-07-15 --- # Docker Compose @@ -420,7 +421,8 @@ constraints deploy: placement: constraints: - - disktype=ssd + - node.labels.disk == ssd + - node.role == manager ``` ```yaml @@ -444,4 +446,25 @@ deploy: placement: preferences: datacenter: us-east -``` \ No newline at end of file +``` + +### `resources` +`resources` configures physical resource constraints for container to run on platform. Those constraints can be configured as: +- `limits`: The platform must prevent the container to allocate more. +- `reservations`: The platform must guarantee the container can allocate at least the configured amount. + +The following can be configured: +- `cpus`: `cpus` configures a limit or reservation for how much of the available CPU resources, as number of cores, a container can use. +- `memory`: `memory` configures a limit or reservation on the amount of memory a container can allocate, set as a string expressing a byte value. +- `pids`: `pids` tunes a container’s PIDs limit, set as an integer. + +```yml +deploy: + resources: + limits: + cpus: 0.5 + memory: 128MiB + reservations: + cpus: 0.3 + memory: 64MiB +```