aspire: could not connect a container to the network
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
This issue occurs when I do dotnet run in the AppHost project, It does not affect the running of the applications however this error is repeated and is printed every second for all the containers
fail: Aspire.Hosting.Dcp.dcpctrl.NetworkReconciler[0]
could not connect a container to the network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 11, "Container": "452393e9a799e8624d921d36b88fa2e187a220d89cc3f5c528b8a59b617a7b7f", "Network": "default-aspire-network-4vd3gfu7i8", "error": "podman command 'ConnectNetwork' returned with non-zero exit code 125: command output: Stdout: '' Stderr: 'Error: container 452393e9a799e8624d921d36b88fa2e187a220d89cc3f5c528b8a59b617a7b7f is already connected to network default-aspire-network-4vd3gfu7i8: network is already connected\n'"}
fail: Aspire.Hosting.Dcp.dcpctrl.NetworkReconciler[0]
could not connect a container to the network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 11, "Container": "0c3bd72d02478e9e67e976fca7a8a11eca7dc5bbb493319dc689dda022c2ff5a", "Network": "default-aspire-network-4vd3gfu7i8", "error": "podman command 'ConnectNetwork' returned with non-zero exit code 125: command output: Stdout: '' Stderr: 'Error: container 0c3bd72d02478e9e67e976fca7a8a11eca7dc5bbb493319dc689dda022c2ff5a is already connected to network default-aspire-network-4vd3gfu7i8: network is already connected\n'"}
fail: Aspire.Hosting.Dcp.dcpctrl.NetworkReconciler[0]
could not connect a container to the network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 11, "Container": "40933e042ba65600e082a0a5299a02500a136fdc9be916f987871669d4ce6909", "Network": "default-aspire-network-4vd3gfu7i8", "error": "podman command 'ConnectNetwork' returned with non-zero exit code 125: command output: Stdout: '' Stderr: 'Error: container 40933e042ba65600e082a0a5299a02500a136fdc9be916f987871669d4ce6909 is already connected to network default-aspire-network-4vd3gfu7i8: network is already connected\n'"}
fail: Aspire.Hosting.Dcp.dcpctrl.NetworkReconciler[0]
could not connect a container to the network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 12, "Container": "452393e9a799e8624d921d36b88fa2e187a220d89cc3f5c528b8a59b617a7b7f", "Network": "default-aspire-network-4vd3gfu7i8", "error": "podman command 'ConnectNetwork' returned with non-zero exit code 125: command output: Stdout: '' Stderr: 'Error: container 452393e9a799e8624d921d36b88fa2e187a220d89cc3f5c528b8a59b617a7b7f is already connected to network default-aspire-network-4vd3gfu7i8: network is already connected\n'"}
fail: Aspire.Hosting.Dcp.dcpctrl.NetworkReconciler[0]
could not connect a container to the network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 12, "Container": "0c3bd72d02478e9e67e976fca7a8a11eca7dc5bbb493319dc689dda022c2ff5a", "Network": "default-aspire-network-4vd3gfu7i8", "error": "podman command 'ConnectNetwork' returned with non-zero exit code 125: command output: Stdout: '' Stderr: 'Error: container 0c3bd72d02478e9e67e976fca7a8a11eca7dc5bbb493319dc689dda022c2ff5a is already connected to network default-aspire-network-4vd3gfu7i8: network is already connected\n'"}
fail: Aspire.Hosting.Dcp.dcpctrl.NetworkReconciler[0]
could not connect a container to the network {"NetworkName": {"name":"default-aspire-network"}, "Reconciliation": 12, "Container": "40933e042ba65600e082a0a5299a02500a136fdc9be916f987871669d4ce6909", "Network": "default-aspire-network-4vd3gfu7i8", "error": "podman command 'ConnectNetwork' returned with non-zero exit code 125: command output: Stdout: '' Stderr: 'Error: container 40933e042ba65600e082a0a5299a02500a136fdc9be916f987871669d4ce6909 is already connected to network default-aspire-network-4vd3gfu7i8: network is already connected\n'"}
Here is my csproj file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>d0ee5701-532e-470f-ae99-a0d293698115</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.2" />
<PackageReference Include="Aspire.Hosting.Keycloak" Version="9.0.0-preview.4.24511.1" />
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="8.2.2" />
</ItemGroup>
<ItemGroup>
other project references here which I've omitted...
</ItemGroup>
</Project>
I’m on linux ubuntu, podman version
> podman -v
podman version 4.9.3
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version info
dotnet --info
.NET SDK:
Version: 9.0.100-rc.2.24474.11
Commit: 315e1305db
Workload version: 9.0.100-manifests.3424025a
MSBuild version: 17.12.0-preview-24473-03+fea15fbd1
Runtime Environment:
OS Name: ubuntu
OS Version: 24.04
OS Platform: Linux
RID: linux-x64
Base Path: /home/shrikanth/dotnet/sdk/9.0.100-rc.2.24474.11/
.NET workloads installed:
[aspire]
Installation Source: SDK 9.0.100-rc.2
Manifest Version: 8.2.2/8.0.100
Manifest Path: /home/shrikanth/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire/8.2.2/WorkloadManifest.json
Install Type: FileBased
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0-rc.2.24473.5
Architecture: x64
Commit: 990ebf52fc
.NET SDKs installed:
9.0.100-rc.2.24474.11 [/home/shrikanth/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/home/shrikanth/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [/home/shrikanth/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/downloa
Anything else?
My Program.cs file
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres")
.WithPgWeb();
var database = postgres.AddDatabase("conductor");
var identity = builder.AddKeycloak("idp", 8443);
var automations = builder.AddProject<Projects.Conductor_Automations>("automations")
.WithReference(database)
.WaitFor(database);
var webapi = builder.AddProject<Projects.Conductor_WebApi>("webapi")
.WithExternalHttpEndpoints()
.WithReference(identity)
.WithReference(database)
.WaitFor(database);
builder.Build().Run();
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (9 by maintainers)
I found that this problem happens if I manually kill the Aspire Developer Control Pane (DCP) while it’s cleaning up.
Specifically, when it does not clean up the Docker networks
default-aspire-network-*. I ran this command to delete all my orphaned aspire networks, after which the problem was fixed.docker network ls --filter name=default-aspire-network- -q | xargs -r docker network rmThe next version of the .NET SDK 9.0.200, see https://github.com/dotnet/sdk/issues/36971
Should be fixed (Aspire
mainbranch) by https://github.com/dotnet/aspire/pull/7085.The dotnet watch issue is fixed in the next version.
@karolz-ms I’ve created one here https://github.com/tang2087/aspire-example/tree/main However i am hitting a new issue that the sql server container cannot start. I will fix it later (after work). Despite of that, the error message already shows as well:
I also pruned networks.
I will try to publish a project somewhere to reproduce this.
You can use docker network prune
@joperezr I updated to Aspire 9.0.0 and that seems to fix it for me Thanks