feat: add docker build network option to azure.yaml#7361
feat: add docker build network option to azure.yaml#7361
Conversation
Allow users to specify `docker.network` in azure.yaml service config (e.g., `network: host`) which is passed as `--network` to docker build. This enables builds behind corporate proxies that need host networking. Fixes #4758 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring Docker build networking from azure.yaml via a new services.<name>.docker.network option, enabling scenarios (like corporate proxies) that require passing --network to docker build.
Changes:
- Added a
buildNetworkparameter to(*docker.Cli).Build()and appends--network <value>when set. - Plumbed
docker.networkfromazure.yaml(DockerProjectOptions.Network) throughContainerHelperinto the Docker build invocation. - Updated both
v1.0andalphaazure.yamlJSON schemas and added unit test coverage for the new flag.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| schemas/v1.0/azure.yaml.json | Adds docker.network property to the v1.0 schema. |
| schemas/alpha/azure.yaml.json | Adds docker.network property to the alpha schema. |
| cli/azd/pkg/tools/docker/docker.go | Extends Build() to accept buildNetwork and pass --network to the build command. |
| cli/azd/pkg/tools/docker/docker_test.go | Adds a table-driven test to verify --network is included/omitted as expected. |
| cli/azd/pkg/tools/docker/acceptance/acceptance_test.go | Updates Build call site to include the new parameter. |
| cli/azd/pkg/project/framework_service_docker.go | Adds Network to DockerProjectOptions to support azure.yaml config. |
| cli/azd/pkg/project/container_helper.go | Passes dockerOptions.Network through to docker.Build(). |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Summary
Fixes #4758
Adds a
docker.networkoption to azure.yaml service config that passes--networktodocker build. This enables builds behind corporate proxies that need host networking.Changes
docker.go— AddedbuildNetworkparam toBuild(); appends--network <value>when non-emptyframework_service_docker.go— AddedNetworkfield toDockerProjectOptionscontainer_helper.go— PassesdockerOptions.Networkthrough todocker.Build()docker_test.go— Table-driven test for network optionv1.0andalphaazure.yaml schemasUsage