aspire: Aspire 9.1 Potential Regression with self-installed WSL2 docker engine (not Docker Desktop) on Windows

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Premise

On my Windows-based company laptop, I use Docker in WSL2 as I am not allowed to install Docker Desktop. I have docker.sock bind to a TCP port on 127.0.0.1:2375, a DOCKER_HOST environment variable on Windows pointing to that address and port, and use a .bat file referenced in the PATH Windows environment variable with the following contents to easily call into wsl docker:

@ECHO OFF

wsl docker %*

I’m currently evaluating .NET Aspire for our software projects and think I found an issue in .NET Aspire 9.1 that was not present in version 9.0.

Problem description

When creating a simple .NET Aspire App Host which hosts a single Docker Container (nginx) and where WithEnvironment is called twice, the Developer Control Plane (DCP) of .NET Aspire is unable to create and run the nginx container.

Aspire 9.1 Fails To Start Container With Two Environment Variables

However, if you remove one of the WithEnvironment calls, the container can be started without issues:

Aspire 9.1 Can Start Container With Single Environment Variable

When I revert the code to two calls to WithEnvironment and change the .NET Aspire version to 9.0.0, then everything works fine.

Aspire 9.0 Can Start Container With Two Environment Variables

Unfortunately, I wasn’t able to extract the docker create command that DCP executes to create the container - but my guess is that there might be a regression there.

Expected Behavior

I expected DCP to start the nginx container without issues.

Workarounds

When using the docker.exe CLI for Windows instead of my custom docker.bat batch file which calls wsl docker, then everything works fine. I also tried it from my personal Desktop PC at home that has Docker Desktop for Windows installed (which comes with the Docker CLI), then everything works flawlessly.

When Docker CLI for Windows is present, everything works flawlessly

Steps To Reproduce

https://github.com/feO2x/AspireDoubleWithEnvironmentIssue

The main branch will not work with the setup described above, the aspire-9_0 branch works flawlessly.

Exceptions (if any)

No response

.NET Version info

.NET SDK: Version: 9.0.202 Commit: 3a53853c30 Workload version: 9.0.200-manifests.21502d11 MSBuild version: 17.13.13+1c2026462

Laufzeitumgebung: OS Name: Windows OS Version: 10.0.26100 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.202\

Installierte .NET-Workloads: Es sind keine installierten Workloads zum Anzeigen vorhanden. Konfiguriert für die Verwendung loose manifests beim Installieren neuer Manifeste.

Host: Version: 9.0.3 Architecture: x64 Commit: 831d23e561

.NET SDKs installed: 8.0.407 [C:\Program Files\dotnet\sdk] 9.0.104 [C:\Program Files\dotnet\sdk] 9.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (9 by maintainers)

Most upvoted comments

We’ve actually updated a couple scenarios in 9.2 that previously required a bind mount to make them work without one (pgadmin, pgweb, and redis commander support), so we should actually offer more support for this scenario than we have previously. I actually think we have a few work items on the backlog that will further improve support for this scenario (even though that may not have been the original purpose for the work items).

@danegsta I think we should run our tests with this setup and document the problems.

Nothing WSL specific here - you get the same thing if you use the batch file to point to docker cli on windows.

DCP adds the com.microsoft.developer.usvc-dev.env label to containers which contains a new line separated list of the environment variables DCP has added. Docker CLI accepts arguments with newline in, but the batch file truncates it’s arguments at the first new line.

I’d highly recommend for this scenario that you use a real docker CLI on windows, pointing to the docker in WSL. (The docker CLI is not part of docker desktop and is licensed under the Apache 2.0 licence). If you want to use your own CLI (i.e. your batch file proxy), then you’re well outside of supported territory.