Repository navigation
Add platform-native local container CLI support - #55249
Conversation
|
Added When you commit this breaking change:
You can refer to the .NET SDK breaking change guidelines |
There was a problem hiding this comment.
Pull request overview
This PR extends the Containers feature area to prefer platform-native local container CLIs (Windows wslc, macOS container) ahead of Docker/Podman, adds explicit LocalRegistry types for them, and updates probing/load behavior and tests to match.
Changes:
- Add
WslcandContaineras explicit local registry types, and prefer them during local CLI detection (platform-gated). - Update local image load logic to use platform-native
image load --input <tar>syntax (and force OCI output when using Applecontainer). - Add/adjust unit + integration test gating and caching of availability probes.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.NET.Build.Containers.UnitTests/DockerDaemonTests.cs | Adds unit coverage for command selection, platform-gated probing, and platform-native load args/OCI forcing behavior. |
| test/Microsoft.NET.Build.Containers.UnitTests/DockerAvailableUtils.cs | Caches Docker/Podman probe results for test-process lifetime and avoids probing platform-native CLIs in these attributes. |
| test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs | Adds platform-gated E2E publish/load/run tests for WSLC and Apple container. |
| test/Microsoft.NET.Build.Containers.IntegrationTests/DockerAvailableUtils.cs | Adds new platform-native availability conditions and caches probe results for the test process. |
| test/Microsoft.NET.Build.Containers.IntegrationTests/ContainerCli.cs | Switches CLI availability/podman detection to use cached status (Docker/Podman-focused). |
| src/Containers/packaging/build/Microsoft.NET.Build.Containers.targets | Updates LocalRegistry comment to include Docker/Podman/Wslc/Container. |
| src/Containers/Microsoft.NET.Build.Containers/Telemetry.cs | Adds telemetry classification for Wslc/Container (and Unknown) local storage types. |
| src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs | Centralizes manifest media type selection via ContainerBuilder.GetManifestMediaType(...). |
| src/Containers/Microsoft.NET.Build.Containers/PublicAPI/net11.0/PublicAPI.Unshipped.txt | Adds new public constants for KnownLocalRegistryTypes.Wslc and .Container. |
| src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/KnownLocalRegistryTypes.cs | Adds Wslc/Container registry types and expands supported list + factory mapping. |
| src/Containers/Microsoft.NET.Build.Containers/LocalDaemons/DockerCli.cs | Implements platform-native probing, selection preference, and file-based image load --input support. |
| src/Containers/Microsoft.NET.Build.Containers/ContainerBuilder.cs | Forces OCI manifest media type when destination local registry is Apple container. |
|
Breaking-change documentation issue created: dotnet/docs#54761. A committer still needs to send the .NET SDK Breaking Change Notification email for this change. |
1e87b49 to
d6760ad
Compare
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Ok @lbussell @mthalman I'm much happier with this pass. This is 4 commits that should be easier to review step by step:
|
Format the nested JSON objects so the Docker archive manifest structure is easier to scan. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0489bafc-54c5-404d-b5ca-bde9210d4df0
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 856ddcdd-30dc-4a14-b19d-450af5d11be2
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0489bafc-54c5-404d-b5ca-bde9210d4df0
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0489bafc-54c5-404d-b5ca-bde9210d4df0
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0489bafc-54c5-404d-b5ca-bde9210d4df0
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0489bafc-54c5-404d-b5ca-bde9210d4df0
|
@lbussell can you take one more look? Had to add a change in this commit to make the data-based tests not report as a test failure on environments where no valid local container runtimes exist. |
|
/ba-g stuck waiting for sdk-report-green, but that check has completed successfully already. |
…ts (#21009) ## Description WSLc can run Aspire apps on Windows, but publishing currently has no WSLc runtime implementation. This adds an initial, deliberately limited publishing implementation so supported image operations use the selected runtime and unsupported operations fail clearly instead of falling back or working around WSLc limitations. This PR targets `main` and builds on the runtime detection and doctor support from #21004, now incorporated into `main`. Supported on Windows: local Dockerfile builds without platform selection, image tagging/removal/push, registry login, native JSON image configuration inspection, and single-platform .NET SDK publishing to WSLc's local image store. Auto-discovery retains Docker → Podman → WSLc priority; explicit case-insensitive selection and custom keyed runtimes remain supported. Native SDK local publishing uses `LocalRegistry=Wslc` and requires an SDK containing the WSLc support introduced in [dotnet/sdk#55249](dotnet/sdk#55249). It was verified with the repository-pinned SDK `11.0.100-rc.1.26425.128`; older SDKs without this support report an unsupported registry rather than falling back to another runtime. Aspire does not implement an archive/load bridge. Unsupported: Compose deployment/management, platform-selected Dockerfile builds, Dockerfile archives/OCI format selection, manifest inspection, multi-platform SDK publishing to WSLc's local image store, and container-file layering (which requires a platform-selected Dockerfile build). Multi-platform image loading is tracked by [microsoft/WSL#41123](microsoft/WSL#41123). These paths reject explicitly using existing exception/inspection-result contracts. Daemon-free single- and multi-platform SDK archives remain supported without WSLc health checks or commands; archive publishing omits `LocalRegistry=Wslc`, preserving compatibility with SDKs that do not recognize it. No alternative builder or runtime fallback is introduced. Dockerfile builds in Docker, Podman, and WSLc now use `ProcessSpec.ArgumentList` instead of a manually quoted command line. Shared eager argument helpers preserve quotes, spaces, backslashes, empty values, and inherited environment values, retaining Podman's existing secret behavior. Platform-specific process argument handling remains owned by .NET, without invoking a shell. ### User-facing usage On Windows, select WSLc with `ASPIRE_CONTAINER_RUNTIME=wslc`. Single-platform .NET SDK publishing then uses WSLc's local store through the SDK's native support. Dockerfile publishing defaults to `linux/amd64`; explicitly opt into the WSLc host platform only when appropriate: ```csharp builder.AddDockerfile("program", "./program") .WithContainerBuildOptions(options => options.TargetPlatform = null); ``` For a .NET SDK archive without container-file layering: ```csharp project.WithContainerBuildOptions(options => { options.Destination = ContainerImageDestination.Archive; options.OutputPath = "./images"; }); ``` ### Validation - `.\restore.cmd /p:SkipNativeBuild=true` — passed during initial setup. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile /p:SkipNativeBuild=true -- --filter-class '*.WslcContainerRuntimeTests' --filter-class '*.ContainerRuntimeResolverTests' --filter-class '*.ContainerRuntimeDetectorTests' --filter-class '*.DockerContainerRuntimeTests' --filter-class '*.ContainerRuntimeBaseTests' --filter-class '*.DotnetProgramArchiveTests' --filter-class '*.DotnetProgramPublishingTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 151 tests after merging `main`, before the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile /p:SkipNativeBuild=true -- --filter-class '*.ContainerRuntimeBaseTests' --filter-class '*.DockerContainerRuntimeTests' --filter-class '*.PodmanSaveArgumentsTests' --filter-class '*.WslcContainerRuntimeTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 95 tests after the argument-list correction and eager helper changes. The runtime-constant follow-up was rebuilt with `--filter-method '*.BuildImageAsync_PreservesArgumentBoundaries'` (same project and exclusions) — passed, 3 cases. The complete 95-test selection was rerun with `--no-build` immediately before pushing — passed. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.BuildSecretsFormats*' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 4 tests after the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-class '*.DotnetProgramArchiveTests' --filter-class '*.DotnetProgramPublishingTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 48 tests after the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.BuildImageAsync_Dotnet*' --filter-method '*.BuildImageAsync_ProjectBuildPassesResolvedContainerRuntimeAsLocalRegistry' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 20 tests after the SDK correction and before the `main` merge. - `.\.dotnet\dotnet.exe publish '<probe-directory>\probe.csproj' --configuration Release /t:PublishContainer --property:LocalRegistry=Wslc --property:ContainerRepository=aspire-wslc-sdk-probe-b35fa7a4 --property:ContainerImageTag=single --property:RuntimeIdentifier=linux-x64 --property:ContainerRuntimeIdentifier=linux-x64 --property:ContainerBaseImage=mcr.microsoft.com/dotnet/runtime:10.0 --source https://packagefeedproxy.microsoft.io/nuget/v3/index.json` — passed using a temporary minimal net10.0 console project and SDK `11.0.100-rc.1.26425.128`. SDK reported successful publication via Wslc; `wslc image inspect aspire-wslc-sdk-probe-b35fa7a4:single --format json` confirmed linux/amd64. Probe image and project cleaned up; the path above is a placeholder for that temporary directory. - Installed WSLc 3.0.3.0: verified local Dockerfile build and native `image inspect --format json`; inspected tag/remove/push/login/build help and DCP's WSLc adapter. Direct `--output type=docker` and `--output type=oci` probes both failed with the Docker-driver exporter limitation, confirming the explicit archive boundary. Probe image/files cleaned up. - Local E2E tests were not run; no E2E tests were added. Linux/macOS execution and live registry push/login were not validated locally. - Existing NU1902/NU1903 warnings for `System.Security.Cryptography.Pkcs` 10.0.12 remain; no dependency changes are included. ### Security considerations The selected WSLc executable is trusted in the same way as Docker/Podman. Image commands use the existing process runner; registry passwords remain on stdin and environment build secrets follow the existing runtime pattern. Native image inspection uses source-generated JSON deserialization and preserves the image reference as a single process argument. Dockerfile build invocations for all three runtimes now preserve argument boundaries through `ProcessSpec.ArgumentList`. No listener, elevated execution, archive extraction, or Aspire-managed archive/load bridge is added. A separate security review has not been performed. Fixes # (issue) ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [x] No --------- Co-authored-by: Copilot App <[email protected]> Copilot-Session: f85e4b06-371e-465a-8fd8-e635d14ec41f Copilot-Session: b35fa7a4-1433-4b70-9840-5f5866230ff4
…ts (#21009) ## Description WSLc can run Aspire apps on Windows, but publishing currently has no WSLc runtime implementation. This adds an initial, deliberately limited publishing implementation so supported image operations use the selected runtime and unsupported operations fail clearly instead of falling back or working around WSLc limitations. This PR targets `main` and builds on the runtime detection and doctor support from #21004, now incorporated into `main`. Supported on Windows: local Dockerfile builds without platform selection, image tagging/removal/push, registry login, native JSON image configuration inspection, and single-platform .NET SDK publishing to WSLc's local image store. Auto-discovery retains Docker → Podman → WSLc priority; explicit case-insensitive selection and custom keyed runtimes remain supported. Native SDK local publishing uses `LocalRegistry=Wslc` and requires an SDK containing the WSLc support introduced in [dotnet/sdk#55249](dotnet/sdk#55249). It was verified with the repository-pinned SDK `11.0.100-rc.1.26425.128`; older SDKs without this support report an unsupported registry rather than falling back to another runtime. Aspire does not implement an archive/load bridge. Unsupported: Compose deployment/management, platform-selected Dockerfile builds, Dockerfile archives/OCI format selection, manifest inspection, multi-platform SDK publishing to WSLc's local image store, and container-file layering (which requires a platform-selected Dockerfile build). Multi-platform image loading is tracked by [microsoft/WSL#41123](microsoft/WSL#41123). These paths reject explicitly using existing exception/inspection-result contracts. Daemon-free single- and multi-platform SDK archives remain supported without WSLc health checks or commands; archive publishing omits `LocalRegistry=Wslc`, preserving compatibility with SDKs that do not recognize it. No alternative builder or runtime fallback is introduced. Dockerfile builds in Docker, Podman, and WSLc now use `ProcessSpec.ArgumentList` instead of a manually quoted command line. Shared eager argument helpers preserve quotes, spaces, backslashes, empty values, and inherited environment values, retaining Podman's existing secret behavior. Platform-specific process argument handling remains owned by .NET, without invoking a shell. ### User-facing usage On Windows, select WSLc with `ASPIRE_CONTAINER_RUNTIME=wslc`. Single-platform .NET SDK publishing then uses WSLc's local store through the SDK's native support. Dockerfile publishing defaults to `linux/amd64`; explicitly opt into the WSLc host platform only when appropriate: ```csharp builder.AddDockerfile("program", "./program") .WithContainerBuildOptions(options => options.TargetPlatform = null); ``` For a .NET SDK archive without container-file layering: ```csharp project.WithContainerBuildOptions(options => { options.Destination = ContainerImageDestination.Archive; options.OutputPath = "./images"; }); ``` ### Validation - `.\restore.cmd /p:SkipNativeBuild=true` — passed during initial setup. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile /p:SkipNativeBuild=true -- --filter-class '*.WslcContainerRuntimeTests' --filter-class '*.ContainerRuntimeResolverTests' --filter-class '*.ContainerRuntimeDetectorTests' --filter-class '*.DockerContainerRuntimeTests' --filter-class '*.ContainerRuntimeBaseTests' --filter-class '*.DotnetProgramArchiveTests' --filter-class '*.DotnetProgramPublishingTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 151 tests after merging `main`, before the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile /p:SkipNativeBuild=true -- --filter-class '*.ContainerRuntimeBaseTests' --filter-class '*.DockerContainerRuntimeTests' --filter-class '*.PodmanSaveArgumentsTests' --filter-class '*.WslcContainerRuntimeTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 95 tests after the argument-list correction and eager helper changes. The runtime-constant follow-up was rebuilt with `--filter-method '*.BuildImageAsync_PreservesArgumentBoundaries'` (same project and exclusions) — passed, 3 cases. The complete 95-test selection was rerun with `--no-build` immediately before pushing — passed. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.BuildSecretsFormats*' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 4 tests after the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-class '*.DotnetProgramArchiveTests' --filter-class '*.DotnetProgramPublishingTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 48 tests after the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.BuildImageAsync_Dotnet*' --filter-method '*.BuildImageAsync_ProjectBuildPassesResolvedContainerRuntimeAsLocalRegistry' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 20 tests after the SDK correction and before the `main` merge. - `.\.dotnet\dotnet.exe publish '<probe-directory>\probe.csproj' --configuration Release /t:PublishContainer --property:LocalRegistry=Wslc --property:ContainerRepository=aspire-wslc-sdk-probe-b35fa7a4 --property:ContainerImageTag=single --property:RuntimeIdentifier=linux-x64 --property:ContainerRuntimeIdentifier=linux-x64 --property:ContainerBaseImage=mcr.microsoft.com/dotnet/runtime:10.0 --source https://packagefeedproxy.microsoft.io/nuget/v3/index.json` — passed using a temporary minimal net10.0 console project and SDK `11.0.100-rc.1.26425.128`. SDK reported successful publication via Wslc; `wslc image inspect aspire-wslc-sdk-probe-b35fa7a4:single --format json` confirmed linux/amd64. Probe image and project cleaned up; the path above is a placeholder for that temporary directory. - Installed WSLc 3.0.3.0: verified local Dockerfile build and native `image inspect --format json`; inspected tag/remove/push/login/build help and DCP's WSLc adapter. Direct `--output type=docker` and `--output type=oci` probes both failed with the Docker-driver exporter limitation, confirming the explicit archive boundary. Probe image/files cleaned up. - Local E2E tests were not run; no E2E tests were added. Linux/macOS execution and live registry push/login were not validated locally. - Existing NU1902/NU1903 warnings for `System.Security.Cryptography.Pkcs` 10.0.12 remain; no dependency changes are included. ### Security considerations The selected WSLc executable is trusted in the same way as Docker/Podman. Image commands use the existing process runner; registry passwords remain on stdin and environment build secrets follow the existing runtime pattern. Native image inspection uses source-generated JSON deserialization and preserves the image reference as a single process argument. Dockerfile build invocations for all three runtimes now preserve argument boundaries through `ProcessSpec.ArgumentList`. No listener, elevated execution, archive extraction, or Aspire-managed archive/load bridge is added. A separate security review has not been performed. Fixes # (issue) ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [x] No --------- Co-authored-by: Copilot App <[email protected]> Copilot-Session: f85e4b06-371e-465a-8fd8-e635d14ec41f Copilot-Session: b35fa7a4-1433-4b70-9840-5f5866230ff4 (cherry picked from commit 64ba1eb)
…ts (#21009) ## Description WSLc can run Aspire apps on Windows, but publishing currently has no WSLc runtime implementation. This adds an initial, deliberately limited publishing implementation so supported image operations use the selected runtime and unsupported operations fail clearly instead of falling back or working around WSLc limitations. This PR targets `main` and builds on the runtime detection and doctor support from #21004, now incorporated into `main`. Supported on Windows: local Dockerfile builds without platform selection, image tagging/removal/push, registry login, native JSON image configuration inspection, and single-platform .NET SDK publishing to WSLc's local image store. Auto-discovery retains Docker → Podman → WSLc priority; explicit case-insensitive selection and custom keyed runtimes remain supported. Native SDK local publishing uses `LocalRegistry=Wslc` and requires an SDK containing the WSLc support introduced in [dotnet/sdk#55249](dotnet/sdk#55249). It was verified with the repository-pinned SDK `11.0.100-rc.1.26425.128`; older SDKs without this support report an unsupported registry rather than falling back to another runtime. Aspire does not implement an archive/load bridge. Unsupported: Compose deployment/management, platform-selected Dockerfile builds, Dockerfile archives/OCI format selection, manifest inspection, multi-platform SDK publishing to WSLc's local image store, and container-file layering (which requires a platform-selected Dockerfile build). Multi-platform image loading is tracked by [microsoft/WSL#41123](microsoft/WSL#41123). These paths reject explicitly using existing exception/inspection-result contracts. Daemon-free single- and multi-platform SDK archives remain supported without WSLc health checks or commands; archive publishing omits `LocalRegistry=Wslc`, preserving compatibility with SDKs that do not recognize it. No alternative builder or runtime fallback is introduced. Dockerfile builds in Docker, Podman, and WSLc now use `ProcessSpec.ArgumentList` instead of a manually quoted command line. Shared eager argument helpers preserve quotes, spaces, backslashes, empty values, and inherited environment values, retaining Podman's existing secret behavior. Platform-specific process argument handling remains owned by .NET, without invoking a shell. ### User-facing usage On Windows, select WSLc with `ASPIRE_CONTAINER_RUNTIME=wslc`. Single-platform .NET SDK publishing then uses WSLc's local store through the SDK's native support. Dockerfile publishing defaults to `linux/amd64`; explicitly opt into the WSLc host platform only when appropriate: ```csharp builder.AddDockerfile("program", "./program") .WithContainerBuildOptions(options => options.TargetPlatform = null); ``` For a .NET SDK archive without container-file layering: ```csharp project.WithContainerBuildOptions(options => { options.Destination = ContainerImageDestination.Archive; options.OutputPath = "./images"; }); ``` ### Validation - `.\restore.cmd /p:SkipNativeBuild=true` — passed during initial setup. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile /p:SkipNativeBuild=true -- --filter-class '*.WslcContainerRuntimeTests' --filter-class '*.ContainerRuntimeResolverTests' --filter-class '*.ContainerRuntimeDetectorTests' --filter-class '*.DockerContainerRuntimeTests' --filter-class '*.ContainerRuntimeBaseTests' --filter-class '*.DotnetProgramArchiveTests' --filter-class '*.DotnetProgramPublishingTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 151 tests after merging `main`, before the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-launch-profile /p:SkipNativeBuild=true -- --filter-class '*.ContainerRuntimeBaseTests' --filter-class '*.DockerContainerRuntimeTests' --filter-class '*.PodmanSaveArgumentsTests' --filter-class '*.WslcContainerRuntimeTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 95 tests after the argument-list correction and eager helper changes. The runtime-constant follow-up was rebuilt with `--filter-method '*.BuildImageAsync_PreservesArgumentBoundaries'` (same project and exclusions) — passed, 3 cases. The complete 95-test selection was rerun with `--no-build` immediately before pushing — passed. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.BuildSecretsFormats*' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 4 tests after the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-class '*.DotnetProgramArchiveTests' --filter-class '*.DotnetProgramPublishingTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 48 tests after the argument-list correction. - `.\.dotnet\dotnet.exe test --project tests\Aspire.Hosting.Tests\Aspire.Hosting.Tests.csproj --no-build --no-launch-profile -- --filter-method '*.BuildImageAsync_Dotnet*' --filter-method '*.BuildImageAsync_ProjectBuildPassesResolvedContainerRuntimeAsLocalRegistry' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'` — passed, 20 tests after the SDK correction and before the `main` merge. - `.\.dotnet\dotnet.exe publish '<probe-directory>\probe.csproj' --configuration Release /t:PublishContainer --property:LocalRegistry=Wslc --property:ContainerRepository=aspire-wslc-sdk-probe-b35fa7a4 --property:ContainerImageTag=single --property:RuntimeIdentifier=linux-x64 --property:ContainerRuntimeIdentifier=linux-x64 --property:ContainerBaseImage=mcr.microsoft.com/dotnet/runtime:10.0 --source https://packagefeedproxy.microsoft.io/nuget/v3/index.json` — passed using a temporary minimal net10.0 console project and SDK `11.0.100-rc.1.26425.128`. SDK reported successful publication via Wslc; `wslc image inspect aspire-wslc-sdk-probe-b35fa7a4:single --format json` confirmed linux/amd64. Probe image and project cleaned up; the path above is a placeholder for that temporary directory. - Installed WSLc 3.0.3.0: verified local Dockerfile build and native `image inspect --format json`; inspected tag/remove/push/login/build help and DCP's WSLc adapter. Direct `--output type=docker` and `--output type=oci` probes both failed with the Docker-driver exporter limitation, confirming the explicit archive boundary. Probe image/files cleaned up. - Local E2E tests were not run; no E2E tests were added. Linux/macOS execution and live registry push/login were not validated locally. - Existing NU1902/NU1903 warnings for `System.Security.Cryptography.Pkcs` 10.0.12 remain; no dependency changes are included. ### Security considerations The selected WSLc executable is trusted in the same way as Docker/Podman. Image commands use the existing process runner; registry passwords remain on stdin and environment build secrets follow the existing runtime pattern. Native image inspection uses source-generated JSON deserialization and preserves the image reference as a single process argument. Dockerfile build invocations for all three runtimes now preserve argument boundaries through `ProcessSpec.ArgumentList`. No listener, elevated execution, archive extraction, or Aspire-managed archive/load bridge is added. A separate security review has not been performed. Fixes # (issue) ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - If yes, did you have an API Review for it? - [ ] Yes - [ ] No - Did you add `<remarks />` and `<code />` elements on your triple slash comments? - [ ] Yes - [ ] No - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - If yes, have you done a threat model and had a security review? - [ ] Yes - [x] No - [x] No --------- Co-authored-by: Copilot App <[email protected]> Copilot-Session: f85e4b06-371e-465a-8fd8-e635d14ec41f Copilot-Session: b35fa7a4-1433-4b70-9840-5f5866230ff4 (cherry picked from commit 64ba1eb)
…capability limits (#21991) Backport of #21009 to release/17.0. ## Customer Impact Users running containers through WSLc on Windows can't use Aspire 17.0 to build, publish, or deploy container images. WSLc is not recognized as a container runtime for publish and deploy, so these operations fail or select the wrong runtime. This change adds a WSLc container runtime, and `aspire doctor` reports explicit capability limits for features that WSLc doesn't support. ## Testing - The original PR passed CI on main. - Ran locally on macOS against this branch: - `dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class "*.ContainerRuntimeBaseTests" --filter-class "*.ContainerRuntimeResolverTests" --filter-class "*.DockerContainerRuntimeTests" --filter-class "*.PodmanSaveArgumentsTests" --filter-class "*.ResourceContainerImageManagerTests" --filter-class "*.WslcContainerRuntimeTests" --filter-class "*.ContainerRuntimeDetectorTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"`: **passed** (84/84) - `dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ContainerRuntimeCheckTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"`: **passed** (78/78) - `WslcDotnetPublishingTests` is Windows-only and was skipped locally. Windows CI on this PR covers it. ## Risk Low to medium. The new behavior applies only when WSLc is the selected container runtime. However, the change also touches shared container runtime code (`ContainerRuntimeBase`, `ContainerRuntimeResolver`, the Docker and Podman runtimes, `ResourceContainerImageManager`, and `ContainerRuntimeDetector`), which affects all runtimes. The existing Docker and Podman unit tests pass. Publishing with `LocalRegistry=Wslc` also requires an SDK that includes dotnet/sdk#55249. ## Regression? No. This is new functionality for WSLc users. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f85e4b06-371e-465a-8fd8-e635d14ec41f Copilot-Session: b35fa7a4-1433-4b70-9840-5f5866230ff4
Summary
Adds platform-native local container tooling and refactors local image loading so each runtime owns its behavior.
wslcCLI and macOS' nativecontainerCLI before Docker or PodmanWslcandMacOSContainervalues for theLocalRegistryMSBuild propertyFixes dotnet/sdk-container-builds#651
Fixes dotnet/sdk-container-builds#636
Review structure
The commits are ordered so each layer can be reviewed independently:
containerizeCLI and its supporting infrastructureRuntime architecture
IContainerRuntimeabstraction for probing, availability, manifest selection, telemetry, and image loadingContainerRuntimefacadeContainerRuntimeOperationsand archive serialization intoContainerArchiveProcess.RunAndCaptureTextAsyncto stream archives to stdin while concurrently draining process outputCleanup and compatibility
containerizeCLI, its parser tests, package contents, Windows redist publishing, and CLI-onlyContainerBuilderpathCreateNewImagetaskKnownLocalRegistryTypes.MacOSContainerpublic APIThe automatic runtime preference and removal of the packaged
containerizeexecutable are breaking changes. Documentation tracking: dotnet/docs#54761.Testing
Microsoft.NET.Build.Containers.UnitTests: 284 total, 277 passed, 7 environment-gated skipsEndToEndWithWslcLocalLoad: passed on Windows with WSLCEndToEndMultiArch_WslcIsRejected: passed on Windows with WSLCEndToEndWithMacOSContainerLocalLoad: platform- and environment-gated for macOS container tooling