VSCode dev container docker-compose optional environment variable file

33 Views Asked by At

I'm using VSCode to run a Dev Containter that uses docker-compose.yml

I have a file of environment variables, which developers can create from a template. The template is in Git (.devcontainer/.env.default) but the environment file is not (.devcontainer/.env) so any secrets etc don't get stored in Git.

I want to use the relatively new docker-compose feature of optional env_file as of compose version 2.24.0 However, when I do that and rebuild the container VSCode complains that env_file must be a string (rather than an object with a "required" boolean).

I'm running Docker Desktop 4.28.0 which includes Docker version 25.0.3 and Docker Compose version v2.24.6-desktop.1 on the host, which I would expect to be sufficient to use the optional env_file feature. However, in the container build log I can see:

...
[2024-03-15T12:10:44.073Z] Client:
 Cloud integration: v1.0.35+desktop.11
 Version:           25.0.3
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        4debf41
 Built:             Tue Feb  6 21:13:02 2024
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.28.0 (139021)
 Engine:
  Version:          25.0.3
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       f417435
  Built:            Tue Feb  6 21:14:25 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
...
[2024-03-15T12:10:48.770Z] Stop (87 ms): Run: docker compose version --short
[2024-03-15T12:10:48.770Z] Docker Compose version: 2.12.2
...

Where is the version of docker-compose that VSCode uses, and how can it be updated?

0

There are 0 best solutions below