Problem
When specifying features and dockerComposeFile in devcontainer.json, build secrets specified in the referenced compose file get ignored when generating the compose override file.
Building the container will exit with:
failed to solve: unexpected key 'env' in 'env=SOME_SECRET'
Error: Command failed: docker compose --project-name ...
Steps to reproduce
- Create a compose file with build secrets:
---
services:
my-service:
image: my-image
build:
secrets:
- some-secret
...
secrets:
some-secret:
file: /path/to/secret/file
...
- Consume secrets in Dockerfile:
...
RUN --mount=type=secret,id=some-secret,env=SOME_SECRET ...
...
- Create devcontainer configuration:
{
...
"dockerComposeFile": "./my-compose.yml",
"service": "my-service",
"features": {
"some-feature": {}
}
...
}
- Build the container with:
devcontainer build --no-cache --workspace-folder . and observe failure log.
- Comment the "features" option in the devcontainer config file and build with success.
Versions
devcontainer: 0.76.0
docker: 28.0.4
docker compose: 2.34.0
platform: Linux (6.6.85-2-MANJARO)
Problem
When specifying
featuresanddockerComposeFileindevcontainer.json, build secrets specified in the referenced compose file get ignored when generating the compose override file.Building the container will exit with:
Steps to reproduce
... RUN --mount=type=secret,id=some-secret,env=SOME_SECRET ... ...{ ... "dockerComposeFile": "./my-compose.yml", "service": "my-service", "features": { "some-feature": {} } ... }devcontainer build --no-cache --workspace-folder .and observe failure log.Versions
devcontainer: 0.76.0docker: 28.0.4docker compose: 2.34.0platform: Linux (6.6.85-2-MANJARO)