devcontainers / devcontainers/spec

How to conditionally include a docker compose extension yml file only if present

Open
#536 1 comment 4 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
5.7k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

In the devcontainer.json file, we can define an array of docker compose files like so:

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

However, if any file is listed here, it *must* exist on the file system or the container will fail to start.

In our environment, some developers will define a docker compose extension yml file and some will not.

We have added a `docker-compose.override.yml` line to our `.gitignore` file and individual developers can opt in to modifying their local development container environment if they choose.

Is this possible using a devcontainer.json configuration? I have made a few attempts, but have been unable to conditionally-include-if-present a given docker compose override/extension yml file.

If not, it would a useful feature to add.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.