From 0d1f5c0fc4900b527716bdb80bd37ce225718563 Mon Sep 17 00:00:00 2001 From: Bhanu Kiran Atturu Date: Fri, 6 Feb 2026 06:37:47 -0500 Subject: [PATCH] Improve Docker Swarm documentation with environment variable example Add option for using AMD_VISIBLE_DEVICES instead of generic resources --- README.md | 19 ++++++++++++++++++- docs/container-runtime/docker-swarm.md | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 896f81a..293fa56 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,7 @@ Configure each swarm node's Docker daemon with GPU resources in `/etc/docker/dae ```json { + "default-runtime": "amd", "runtimes": { "amd": { "path": "amd-container-runtime", @@ -283,6 +284,8 @@ sudo systemctl restart docker Deploy services with specific GPU requirements using docker-compose: +**Using generic resources:** + ```yaml # docker-compose.yml for Swarm deployment version: '3.8' @@ -290,7 +293,6 @@ services: rocm-service: image: rocm/dev-ubuntu-24.04 command: rocm-smi - runtime: amd deploy: replicas: 1 resources: @@ -301,6 +303,21 @@ services: value: 1 ``` +**Using environment variables:** + +```yaml +# docker-compose.yml for Swarm deployment with environment variable +version: '3.8' +services: + rocm-service: + image: rocm/dev-ubuntu-24.04 + command: rocm-smi + environment: + - AMD_VISIBLE_DEVICES=all + deploy: + replicas: 1 +``` + Deploy the service: ```bash docker stack deploy -c docker-compose.yml rocm-stack diff --git a/docs/container-runtime/docker-swarm.md b/docs/container-runtime/docker-swarm.md index 454bead..7ed9980 100644 --- a/docs/container-runtime/docker-swarm.md +++ b/docs/container-runtime/docker-swarm.md @@ -10,6 +10,7 @@ Configure each swarm node's Docker daemon with GPU resources in `/etc/docker/dae ```json { + "default-runtime": "amd", "runtimes": { "amd": { "path": "amd-container-runtime", @@ -32,6 +33,8 @@ sudo systemctl restart docker Deploy services with specific GPU requirements using docker-compose: +**Using generic resources:** + ```yaml # docker-compose.yml for Swarm deployment version: '3.8' @@ -39,7 +42,6 @@ services: rocm-service: image: rocm/dev-ubuntu-24.04 command: rocm-smi - runtime: amd deploy: replicas: 1 resources: @@ -50,6 +52,21 @@ services: value: 1 ``` +**Using environment variables:** + +```yaml +# docker-compose.yml for Swarm deployment with environment variable +version: '3.8' +services: + rocm-service: + image: rocm/dev-ubuntu-24.04 + command: rocm-smi + environment: + - AMD_VISIBLE_DEVICES=all + deploy: + replicas: 1 +``` + Deploy the service: ```bash docker stack deploy -c docker-compose.yml rocm-stack