https://docs.docker.com/compose/extends/#understanding-multiple-compose-files
Per the docker documentation, given a docker-compose.yml and docker-compose.override.yml that reference the same service but different Dockerfiles...
Empty array for "dockerComposeFile" in .devcontainer.json results in docker-compose -f docker-compose.yml up
Empty array for "dockerComposeFile" in .devcontainer.json results in docker-compose up
docker-compose.yml
services:
ubuntu-test:
build:
context: .
dockerfile: base.Dockerfile
version: '3.7'
docker-compose.override.yml
services:
ubuntu-test:
build:
context: .
dockerfile: override.Dockerfile
version: '3.7'
$ docker-compose config
services:
ubuntu-test:
build:
context: /home/jonfen/docker-compose-override-test
dockerfile: override.Dockerfile
version: '3.7'
$ docker-compose -f docker-compose.override.yml -f docker-compose.yml config
services:
ubuntu-test:
build:
context: /home/jonfen/docker-compose-override-test
dockerfile: base.Dockerfile
version: '3.7'
$ docker-compose -f docker-compose.yml -f docker-compose.override.yml config
services:
ubuntu-test:
build:
context: /home/jonfen/docker-compose-override-test
dockerfile: override.Dockerfile
version: '3.7'
References:
https://aka.ms/vscode-remote/devcontainer.json
@jonfen This is a good suggestion - you can add a list of compose files in an array to get the same effect, but this is more convenient particularly when reusing an existing docker-compose.yml.
Got it - good point. For the benefit of the thread:
docker-compose config --> results in using the Dockerfile referenced in docker-compose.override.yml
docker-compose -f docker-compose.yml -f docker-compose.override.yml config --> results in using the Dockerfile referenced in docker-compose.yml
try it :slightly_smiling_face:
so an empty list implicitly uses the override file for precedence, while the explicitly list uses the base file for precedence
So effectively, this is a gap right now.
So effectively, this is a gap right now.
I stand corrected, explicitly listing does work -- as long as you have the correct order in _dockerComposeFile_. I added examples to illustrate.
I ran into this today for a project that has a shared docker-compose.yml, but allows for overrides to handle things like user home directory mounts, GPG-agent socket mounts (for YubiKey GPG commit signing) etc. Implementing this feature request would be :ok_hand:
Out of curiosity, is the source for the Remote Extension available anywhere for contributions? Since Insiders release, I've been looking but can't find anything anywhere and would love to help where I can.
@mdwheele The Remote extensions are not open source, please see our FAQ on license and privacy. Thanks for offering your help.
I ran into this today for a project that has a shared
docker-compose.yml, but allows for overrides to handle things like user home directory mounts, GPG-agent socket mounts (for YubiKey GPG commit signing) etc. Implementing this feature request would be 馃憣Out of curiosity, is the source for the Remote Extension available anywhere for contributions? Since Insiders release, I've been looking but can't find anything anywhere and would love to help where I can.
Same here.
Most helpful comment
I ran into this today for a project that has a shared
docker-compose.yml, but allows for overrides to handle things like user home directory mounts, GPG-agent socket mounts (for YubiKey GPG commit signing) etc. Implementing this feature request would be :ok_hand:Out of curiosity, is the source for the Remote Extension available anywhere for contributions? Since Insiders release, I've been looking but can't find anything anywhere and would love to help where I can.