ERROR: The Compose file './docker-compose.yaml' is invalid because: Unsupported config option for services.nvidia-smi-test: 'runtime'

ERROR: The Compose file './docker-compose.yaml' is invalid because: Unsupported config option for services.nvidia-smi-test: 'runtime'

这是我的 docker-compose.yaml:

version: '2.3'

services:
 nvidia-smi-test:
  runtime: nvidia
  image: nvidia/cuda:9.0-base
  environment:
      - NVIDIA_VISIBLE_DEVICES=all

当我运行docker-compose up时会出现:

ERROR: The Compose file './docker-compose.yaml' is invalid because:
Unsupported config option for services.nvidia-smi-test: 'runtime'

但如果我不使用 docker-compose 只需使用命令 docker run --runtime=nvidia nvidia/cuda:9.0-base nvidia-smi 没有错误 , 我不知道到底出了什么问题。下面是 docker 和 docker-compose 的版本:

Docker version 19.03.5, build 633a0ea838
docker-compose version 1.17.0, build ac53b73

如果大家能提意见,我将不胜感激!

我发现问题了,这是因为docker-compose版本不对,DockerCompose必须是1.19.0或更高版本。

我刚刚卸载了docker-compose(版本1.17.0)并安装了docker-compose(版本1.21.2)一切顺利!