dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.93k stars 480 forks source link

AppHost Container DisconnectNetwork issue #6662

Closed leomoty closed 1 week ago

leomoty commented 1 week ago

Is there an existing issue for this?

Describe the bug

After the container gets built, instead of gracefully starting, docker network related errors are thrown, the container can be manually started from the docker desktop application or CLI, but this happens consistently from AppHost.

Expected Behavior

Container starts successfully after being built and no networking errors are thrown.

Steps To Reproduce

I can easily reproduce it by just having something very similar to:

var builder = DistributedApplication.CreateBuilder(args);

var container= builder
    .AddDockerfile(
        "test",
        "path/to/context",
        "Dockerfile")
    .WithContainerName("test");

Exceptions (if any)

fail: Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0] could not detach network from the container {"Container": {"name":"test"}, "Reconciliation": 22, "ContainerID": "bcec20cb2fc00a79b30d6a8ce0f456937da235d42fecc02c40d28da03161f9f9", "Network": "", "error": "docker command 'DisconnectNetwork' returned with non-zero exit code 1: command output: Stdout: '' Stderr: 'Error response from daemon: page not found\n'"}

.NET Version info

dotnet --info .NET SDK: Version: 8.0.401

Anything else?

Using Aspire.Hosting.AppHost version 8.1.0, also VS 2022 (17.11.3)

dbreshears commented 1 week ago

@leomoty , I wasn't able to reproduce this in 17.12 / Aspire 9.0 , however this error is a bit odd and seems like Docker is in a strange state. Can you try those builds and what version of Docker Desktop do you have installed? Can you try resetting it?

leomoty commented 1 week ago

@leomoty , I wasn't able to reproduce this in 17.12 / Aspire 9.0 , however this error is a bit odd and seems like Docker is in a strange state. Can you try those builds and what version of Docker Desktop do you have installed? Can you try resetting it?

Okay, interestingly going to VS17.12 and Aspire 9.0, worked first try, I made no other changes.

dbreshears commented 1 week ago

Ok, thanks for the reply and good it is resolved. We did fix some issues around network cleanup but that error message sure didn't seem familiar or something I recall seeing.