Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 8d34f89

Browse files
IEvangelistadegeo
andauthored
Add details about how container networks are managed (#4041)
* Add details about how container networks are managed * Fix MD * Update docs/fundamentals/networking-overview.md Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com> --------- Co-authored-by: Andy (Steve) De George <67293991+adegeo@users.noreply.github.com>
1 parent 4f8368b commit 8d34f89

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

docs/architecture/overview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET Aspire architecture overview
33
description: Learn about the overall architecture of .NET Aspire, including its integrations, orchestration, and networking capabilities.
4-
ms.date: 05/09/2025
4+
ms.date: 07/11/2025
55
---
66

77
# .NET Aspire architecture overview
@@ -165,7 +165,9 @@ Continuing from the [diagram in the previous](#app-host-dcp-flow) section, consi
165165

166166
:::image type="content" source="media/dcp-architecture-thumb.png" alt-text="A diagram depicting the architecture of the Developer Control Plane (DCP)." lightbox="media/dcp-architecture.png":::
167167

168-
DCP logs are streamed back to the app host, which then forwards them to the developer dashboard. While the developer dashboard exposes commands such as start, stop, and restart, these commands are not part of DCP itself. Instead, they are implemented by the app model runtime, specifically within its "dashboard service" component. These commands operate by manipulating DCP objects—creating new ones, deleting old ones, or updating their properties. For example, restarting a .NET project involves stopping and deleting the existing <xref:Aspire.Hosting.ApplicationModel.ExecutableResource> representing the project and creating a new one with the same specifications. For more information on commands, see [Custom resource commands in .NET Aspire](../fundamentals/custom-resource-commands.md).
168+
DCP logs are streamed back to the app host, which then forwards them to the developer dashboard. While the developer dashboard exposes commands such as start, stop, and restart, these commands are not part of DCP itself. Instead, they are implemented by the app model runtime, specifically within its "dashboard service" component. These commands operate by manipulating DCP objects—creating new ones, deleting old ones, or updating their properties. For example, restarting a .NET project involves stopping and deleting the existing <xref:Aspire.Hosting.ApplicationModel.ExecutableResource> representing the project and creating a new one with the same specifications.
169+
170+
For more information on container networking, see [How container networks are managed](../fundamentals/networking-overview.md#how-container-networks-are-managed).
169171

170172
## Developer dashboard
171173

docs/fundamentals/networking-overview.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET Aspire inner loop networking overview
33
description: Learn how .NET Aspire handles networking and endpoints, and how you can use them in your app code.
4-
ms.date: 10/29/2024
4+
ms.date: 07/11/2025
55
ms.topic: overview
66
---
77

@@ -30,6 +30,29 @@ To help visualize how endpoints work, consider the .NET Aspire starter templates
3030

3131
:::image type="content" source="media/networking/networking-proxies-1x.png" lightbox="media/networking/networking-proxies.png" alt-text=".NET Aspire Starter Application template inner loop networking diagram.":::
3232

33+
## How container networks are managed
34+
35+
When you add one or more container resources, .NET Aspire creates a dedicated container bridge network to enable service discovery between containers. This bridge network is a virtual network that lets containers communicate with each other and provides a DNS server for container-to-container service discovery using DNS names.
36+
37+
The network's lifetime depends on the container resources:
38+
39+
- If all containers have a session lifetime, the network is also session-based and is cleaned up when the app host process ends.
40+
- If any container has a persistent lifetime, the network is persistent and remains running after the app host process terminates. Aspire reuses this network on subsequent runs, allowing persistent containers to keep communicating even when the app host isn't running.
41+
42+
For more information on container lifetimes, see [Container resource lifetime](orchestrate-resources.md#container-resource-lifetime).
43+
44+
Here are the naming conventions for container networks:
45+
46+
- **Session networks**: `aspire-session-network-<unique-id>-<app-host-name>`
47+
- **Persistent networks**: `aspire-persistent-network-<project-hash>-<app-host-name>`
48+
49+
Each app host instance gets its own network resources. The only differences are the network's lifetime and name; service discovery works the same way for both.
50+
51+
Containers register themselves on the network using their resource name. Aspire uses this name for service discovery between containers. For example, a `pgadmin` container can connect to a database resource named `postgres` using `postgres:5432`.
52+
53+
> [!NOTE]
54+
> Host services, such as projects or other executables, don't use container networks. They rely on exposed container ports for service discovery and communication with containers. For more details on service discovery, see [service discovery overview](../service-discovery/overview.md).
55+
3356
## Launch profiles
3457

3558
When you call <xref:Aspire.Hosting.ProjectResourceBuilderExtensions.AddProject%2A>, the app host looks for _Properties/launchSettings.json_ to determine the default set of endpoints. The app host selects a specific launch profile using the following rules:

0 commit comments

Comments
 (0)