Vscode-remote-release: .devcontainer.json lacks docker-compose.override.yml support

Created on 31 Jul 2019  路  6Comments  路  Source: microsoft/vscode-remote-release

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...

Current Behavior:

Empty array for "dockerComposeFile" in .devcontainer.json results in docker-compose -f docker-compose.yml up

Ideal Behavior:

Empty array for "dockerComposeFile" in .devcontainer.json results in docker-compose up

Given

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'

Tests

$ 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

containers feature-request

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.

All 6 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings