dev_container: Resolve compose service build args in Dockerfile expansion#54270
Merged
KyleBarton merged 3 commits intozed-industries:mainfrom Apr 21, 2026
Merged
Conversation
…sion
For docker-compose devcontainers, build args live on the primary compose
service's `build.args`, not on `dev_container.build` (which is `None`).
`expanded_dockerfile_content` only looked at the latter, so `${…}`
references in the service's Dockerfile (e.g. `FROM ${BASE_IMAGE}`) were
never substituted. Downstream callers then invoked `docker inspect
"${BASE_IMAGE}"` and `docker pull "${BASE_IMAGE}"`, both of which fail.
Dispatch on `build_type` and pull the args from the correct source.
Release Notes:
- Fixed dev container startup failing for docker-compose configs whose service Dockerfile uses build-arg substitution in the FROM line (for example, \`FROM \${BASE_IMAGE}\`).
a564075 to
764491f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For docker-compose-based dev containers, build args live on the primary compose service's
build.args, not ondev_container.build(which isNonein the compose case).expanded_dockerfile_contentonly consulted the latter, so${…}references in the service's Dockerfile — e.g.FROM ${BASE_IMAGE}— were never substituted. Downstream callers then invokeddocker inspect "${BASE_IMAGE}"anddocker pull "${BASE_IMAGE}", both of which fail and the dev container fails to start.A new unit test
test_expands_compose_service_args_in_dockerfilemounts a Dockerfile withFROM ${BASE_IMAGE}backed by a compose service whosebuild.argsdefineBASE_IMAGE=test_image:latest, and asserts bothexpanded_dockerfile_contentandimage_from_dockerfileproduce the resolved reference.Self-Review Checklist:
Release Notes:
FROM ${BASE_IMAGE}).