dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.8k stars 450 forks source link

[AzureTools][Aspire] The state of the corresponding container created by .withdockerfile in the dashboard does not change with it when restarting the conatiner in the Docker Desktop #6246

Open v-mengwe opened 2 weeks ago

v-mengwe commented 2 weeks ago

Clean machine: Win11 x64 23H2 ENU VS Version: VS 17.12.0 Preview 3.0 [35409.206.d17.12] Aspire Version: 9.0.0-rc.1.24509.13 Apply NuGet Feeds Docker Desktop: 4.34.2

REPRO STEPS:

  1. Create a new ASP.NET Core Web App project with 'Enlist in Aspire orchestration' checked.
  2. Right-click the web project -> Add -> Docker Support -> Linux and Dockerfile.
  3. Add .withdockerfile codes in the programs.cs file of AppHost project.
var builder = DistributedApplication.CreateBuilder(args);

var container = builder.AddContainer("dockercontainer", "dockerimage")
                       .WithDockerfile("../", "./WebApplication3/Dockerfile");
builder.AddProject<Projects.WebApplication3>("webapplication3");

builder.Build().Run();
  1. Add the NuGet.Config file to the web project-> Add code COPY ["WebApplication3/NuGet.Config", "."] into Dockerfile file for the web project.
  2. F5 -> Restart the running container in Docker Desktop.
  3. Check whether the state of the corresponding container in the dashboard changes accordingly.

Expect: The state of the corresponding container in the dashboard changes accordingly.

Actual: The state of the corresponding container in the dashboard does not change with it. Image

More Info:

  1. This issue doesn't reproduce for the container created by the Aspire starter project with redis checked.
  2. This issue doesn't reproduce when starting/stopping the running container in Docker Desktop.
v-mengwe commented 3 days ago

Verified on the VS 17.12.0 [35422.214.d17.12] with Aspire 9.0.0, this issue still reproduces.