microsoft / microsoft/aspire

Regression in Docker Compose publishing

Open
#15,838 6 comments 0 reactions 0 assignees View on GitHub
area-deployment docker-compose
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

## Reproduction Scenario
Consider the following setup:

- Environment A
- Defines an SQL Server resource

- Environment B

- Defines a Project resource
The project depends on the SQL Server from Environment A
A shared Docker network is explicitly configured to allow communication between the two environments

This configuration previously published correctly.

## Regression Details
With the changes introduced in commit
ada29f2739e724d5fc256344f9356a5021523dfd, the following code paths are affected:

DockerComposeServiceResourceExtensions.cs, lines:

https://github.com/microsoft/aspire/blob/cad91f3fa2f5ac7a999e50fba881b1c80819fee8/src/Aspire.Hosting.Docker/DockerComposeServiceResourceExtensions.cs#L24
https://github.com/microsoft/aspire/blob/cad91f3fa2f5ac7a999e50fba881b1c80819fee8/src/Aspire.Hosting.Docker/DockerComposeServiceResourceExtensions.cs#L52

When publishing with multiple Docker Compose environments, these changes result in a KeyNotFoundException, preventing successful publish.

### Expected Behavior

Publishing an Aspire application that spans multiple Docker Compose environments should continue to work as it did in 1.x, as long as networks and dependencies are explicitly configured.

### Steps To Reproduce

Create two DockerComposeEnvironment, assign a resource each, reference the endpoint of a resource to the other, then try to publish the artifacts

### Exceptions (if any)

_No response_

### .NET Version info

.NET SDK:
Version: 10.0.201
Commit: 4d3023de60
Workload version: 10.0.200-manifests.121cc9e6
MSBuild version: 18.3.0-release-26153-122+4d3023de6

Ambiente di runtime:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.201\

Carichi di lavoro .NET installati:
[android]
Origine dell'installazione: VS 18.4.11626.88
Versioni del manifesto: 36.1.30/10.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.30\WorkloadManifest.json
Tipo di installazione: Msi

[maccatalyst]
Origine dell'installazione: VS 18.4.11626.88
Versioni del manifesto: 26.2.10217/10.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.2.10217\WorkloadManifest.json
Tipo di installazione: Msi

[maui-windows]
Origine dell'installazione: VS 18.4.11626.88
Versioni del manifesto: 10.0.20/10.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
Tipo di installazione: Msi

[ios]
Origine dell'installazione: VS 18.4.11626.88
Versioni del manifesto: 26.2.10217/10.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.2.10217\WorkloadManifest.json
Tipo di installazione: Msi

Configurato per l'uso "workload sets" durante l'installazione di nuovi manifesti.
Non sono installati set di carico di lavoro. Esegui il "dotnet workload restore" per installare un set del carico di lavoro.

Host:
Version: 10.0.5
Architecture: x64
Commit: a612c2a105

.NET SDKs installed:
6.0.428 [C:\Program Files\dotnet\sdk]
8.0.418 [C:\Program Files\dotnet\sdk]
9.0.312 [C:\Program Files\dotnet\sdk]
10.0.100-rc.1.25451.107 [C:\Program Files\dotnet\sdk]
10.0.103 [C:\Program Files\dotnet\sdk]
10.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.5 [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.24 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

### Anything else?

Aspire Version 2.1, upgraded from 1.2
Using Visual Studio or Visual Studio Code

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.