docker-compose: Unsupported config option for 'runtime'

Viewed 1826

Recently, I have reinstalled my Ubuntu 20.04 and I am trying to run my docker-compose.yml using docker-compose up --build. And I am getting following error,

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

And my docker-compose.yml is

version: '3'
                                                                                                       
services:                                                                                              
  test:
    image: nvidia/cuda:11.0-base
    command: nvidia-smi
    runtime: nvidia 

In my previous Ubuntu 20.04 it was working fine, but after new docker installation I am getting this error. Additionally, I have also installed Nvidia Container Toolkit.

Furthermore, the command docker run --rm --runtime=nvidia nvidia/cuda:11.0-base nvidia-smi is also working as expected.

I appreciate any help to solve this problem.

Thank you.

1 Answers

This is highly version dependent problem.

Most of answers are in thread https://github.com/docker/compose/issues/6239 It seems to work on 1.27 as both v2 and v3 compose syntaxes have been merged, but broke on 1.28 and this undocumented madness unfortunately goes on.

If you expect it to work with docker-compose, than you should probably stick with version that has been known for working with this feature for now.

Related