Skip to content

Aspire.Hosting.Publishing aspire publish does not pass build arguments to docker when using WithBuildArg #10069

Open
@Hieumih

Description

@Hieumih

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When using WithBuildArg(...) in an Aspire project to pass build-time variables, the arguments are not forwarded to docker build. This causes missing environment values at build-time.

Expected Behavior

Build arguments set via WithBuildArg should be forwarded to the docker build command using --build-arg KEY=VALUE.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use .WithBuildArg("MY_ARG", "value") on a container resource.
  2. Run aspire publish
  3. Observe that docker build does not include --build-arg MY_ARG=value
    DockerContainerRuntime.cs — RunDockerBuildAsync does not currently include logic to forward build args.

Exceptions (if any)

No response

.NET Version info

.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968

Anything else?

.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions