From 3c5eb9cc541e44ee1af3e8f9790f1843d2df53da Mon Sep 17 00:00:00 2001 From: Renaud Gaubert Date: Thu, 30 Nov 2017 02:14:46 +0100 Subject: [PATCH] Add Generic Resources Signed-off-by: Renaud Gaubert --- compose/compose-file/index.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/compose/compose-file/index.md b/compose/compose-file/index.md index b862a4f6215e..df08b6d8f833 100644 --- a/compose/compose-file/index.md +++ b/compose/compose-file/index.md @@ -675,6 +675,14 @@ services: reservations: cpus: '0.0001' memory: 20M + generic_resources: + - discrete_resource_spec: + kind: 'gpu' + value: 2 + - discrete_resource_spec: + kind: 'ssd' + value: 1 + ``` The topics below describe available options to set resource constraints on @@ -691,6 +699,23 @@ 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} +##### Generic Resources + +Generic resources are a way to select the kind of nodes your task can land on. + +In a swarm cluster, nodes can advertise Generic resources as Discrete values or +as Named values such as SSD=3 or GPU=UID1, GPU=UID2, ... + +The Generic resources on a service allows you to request for a number of these +Generic resources advertised by swarm nodes and have your tasks land on nodes +with enough available resources to statisfy your request. + +If you requested Named Generic resource(s), the resources selected will be +exposed in your container through the use of environment variables. +E.g: `DOCKER_RESOURCE_GPU=UID1,UID2` + +You can only set the `generic_resources` field for reservations. + ##### Out Of Memory Exceptions (OOME) If your services or containers attempt to use more memory than the system has