dotnet / dotnet/Docker.DotNet

Mapped PublicPort in ContainerListResponse is wrong

Open
#511 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
416
PR merge metrics
No merged PRs in 30d

Description

**Output of `dotnet --info`:**

```
.NET SDK (gemäß "global.json"):
Version: 5.0.201
Commit: a09bd5c86c

Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.201\

Host (useful for support):
Version: 5.0.4
Commit: f27d337295

.NET SDKs installed:
3.1.407 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
```

**What version of Docker.DotNet?:**

```
3.125.4
```

**Steps to reproduce the issue:**

I am using https://github.com/HofmeisterAn/dotnet-testcontainers which uses this library for example [here](https://github.com/HofmeisterAn/dotnet-testcontainers/blob/aa3d573129045a26de08e1fe57ccc180b1e04108/src/DotNet.Testcontainers/Clients/DockerContainerOperations.cs#L50) which leads to the describedbehavior.

1. Start a container with a mapped port. In this case kafka with port mapping 0.0.0.0:51147->9092
2. Get a ContainerListResponse by calling ListContainersAsync see [here](https://github.com/HofmeisterAn/dotnet-testcontainers/blob/aa3d573129045a26de08e1fe57ccc180b1e04108/src/DotNet.Testcontainers/Clients/DockerContainerOperations.cs#L50)
3. The returned ContainerListResponse object lists the wrong public port. In this case 49160

**What actually happened?:**

The returned ContainerListResponse object lists the wrong public port. In this case 49160

**What did you expect to happen?:**

The returned ContainerListResponse object lists the public port 51147

**Additional information:**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.