dotnet / dotnet/Docker.DotNet

HostConfig do not map my port

Open
#462 3 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`:**

```
Version: 3.1.401
Commit: 5b6f5e5005

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.401\

Host (useful for support):
Version: 3.1.7
Commit: fcfdef8d6b
```

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

```
3.125.4
```

**What actually happened?:**

when i create my container i want to map my host port with my container port
see my code below

```
var runParams = new CreateContainerParameters()
{
Image = imageName,
Name = "containertest_" + Guid.NewGuid().ToString().Substring(0, 5),
HostConfig = new HostConfig
{
PortBindings = new Dictionary>{
{ "80" , new List { new PortBinding {HostIP ="0.0.0.0", HostPort = "5569"} } }

}
}
};

var containerAdhock = await _clientDocker.Containers.CreateContainerAsync(runParams);

_ = await _clientDocker.Containers.StartContainerAsync(containerAdhock.ID, null);
```
my container start successfuly but i cannot acces to it.
![image](https://user-images.githubusercontent.com/36570423/91458522-e6e0ad80-e885-11ea-97e0-7ce36d4bece7.png)

**What did you expect to happen?:**
**0.0.0.0:5569->80/tcp**

what is my mistake?

have nice day

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.