{"id":"5ee3617d-f052-4106-bbfc-410c85e1f9f5","task":"Grant a Docker Compose service access to all host GPUs","domain":"docs.docker.com","steps":["Confirm the host has working GPU support: NVIDIA drivers installed and `nvidia-smi` prints device info, and the NVIDIA Container Toolkit is installed and the Docker daemon is configured for it.","In compose.yaml add a device reservation to the service under `deploy.resources.reservations.devices` with `driver: nvidia` and `capabilities: [gpu]`.","Example: services: test: { image: nvidia/cuda:12.9.0-base-ubuntu22.04, command: nvidia-smi, deploy: { resources: { reservations: { devices: [ { driver: nvidia, capabilities: [gpu] } ] } } } }.","Run `docker compose up` and check the container logs / output for the GPU (nvidia-smi should list a detectable device).","When neither `count` nor `device_ids` is set, Compose grants access to ALL host GPUs by default.","Official docs: https://docs.docker.com/compose/how-tos/gpu-support/ and full property reference https://docs.docker.com/reference/compose-file/deploy/#devices"],"gotchas":["The `capabilities: [gpu]` field is mandatory; omitting it makes deployment return an error.","GPU access requires the host to have GPUs AND the Docker daemon configured with the NVIDIA Container Toolkit; otherwise the service fails to start.","This grants all GPUs when unset -- restrict with count or device_ids for multi-GPU hosts."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T14:26:45.158Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T14:26:45.158Z"},"url":"https://mcp.waymark.network/r/5ee3617d-f052-4106-bbfc-410c85e1f9f5"}