How to correctly specify multiple docker-compose.yml files in devcontainer.json

Viewed 506

An error occurred when starting a container with multiple docker-compose files using the VSCode's Remove-Containers feature like Open Folder in Container.

Multiple files are specified as follows.

# .devcontainer/devcontainer.json

"dockerComposeFile": [
    "../docker-compose.yml",
    "docker-compose.devcontainer.yml"
]

The hierarchy of folders is as follows.

│── .devcontainer
│   ├── devcontainer.json
│   └── docker-compose.devcontainer.yml
├── Dockerfile.cpu
├── Dockerfile.tensorboard
├── docker-compose.yml

I got the below error on the DevContainer Terminal log.

Command failed: docker-compose -f /path/to/project/src/gan/stargan/docker-compose.yml -f /path/to/project/src/gan/stargan/.devcontainer/docker-compose.devcontainer.yml config --services

If I specify only docker-compose.yml in the devcontainer.json file, the container will start correctly, but if I do more than one as described above, an error will occur.

How do I correctly specify more than one docker-compose.yml?

here is the repository


The reason docker-compose didn't work was that I was trying to launch nvidia-docker, which compose doesn't support, and it was an issue with my compose configuration, not VScode.

0 Answers
Related