Error when exposing multiple ports on Docker container
- 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
Hi,
I'm encountering an issue after upgrading from Aspire 8.2.2 to Aspire 9.2.1. In version 8.2.2, I was able to create a Docker container (specifically for [mountebank](https://www.mbtest.org/)) with multiple exposed ports using Aspire. However, after migrating to 9.2.1, the same configuration fails to start the container.
Sample Code: ` var builder = DistributedApplication.CreateBuilder(args);
builder.AddContainer("mountebank", "bbyars/mountebank")
.WithHttpEndpoint(port: 5000, targetPort: 5000, name: StorageSharedService)
.WithHttpEndpoint(port: 9000, targetPort: 9090, name: "control");
await builder.Build().RunAsync().ConfigureAwait(true);`
Error: `Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0]
could not create the container {"Container": {"name":"mountebank-qqtkwshe"}, "Reconciliation": 3, "ContainerName": "mountebank-qqtkwshe", "error": "object not found\ncontainer not found\ndocker command 'CreateContainer' returned with non-zero exit code 1: command output: Stdout: '' Stderr: ''"}`
### Expected Behavior
Aspire should allow the creation of a Docker container with multiple exposed ports, as it did in 8.2.2.
### Steps To Reproduce
1. Use Aspire 9.2.1.
3. Define a container resource with multiple ports exposed (e.g., 2525, 4545).
5. Run the app and observe container creation failure.
### Exceptions (if any)
`Aspire.Hosting.Dcp.dcpctrl.ContainerReconciler[0]
could not create the container {"Container": {"name":"mountebank-jevkhtef"}, "Reconciliation": 3, "ContainerName": "mountebank-jevkhtef", "error": "object not found\ncontainer not found\ndocker command 'CreateContainer' returned with non-zero exit code 1: command output: Stdout: '' Stderr: ''"}`
### .NET Version info
.NET 8
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.