Docker Compose returns error about property devices when trying to enable GPU

Viewed 598

I am trying to run my docker image using docker-compose. I have created a docker image named visual_detector_v3 and also created a docker-compose.yaml file to use it:

version: '3.7'
services:
  VisualDetections:
    image: 'visual_detector_v3:latest'
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

which is basically composed of the example given in the documentation.
The only differences are that I have removed command (which I did not needed), changed test to VisualDetections and added version.

services:
  test:
    image: nvidia/cuda:10.2-base
    command: nvidia-smi
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Anyway, when I tried to execute using:

$docker stack deploy --compose-file docker-compose.yaml visualdetections

services.VisualDetections.deploy.resources.reservations Additional property devices is not allowed

which does not seem to be affected by the changes I have made but rather from reservations. So, can you provide any thought on this issue?

The machine I am trying to run it has 2 GPUs and runs Ubuntu 18.04.

1 Answers
Related