Merge pull request #1434 from docker/PortBindings

set PortBinding HostIP
This commit is contained in:
Guillaume Tardif 2021-03-17 18:35:39 +01:00 committed by GitHub
commit 3f502000e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -366,7 +366,9 @@ func buildContainerPortBindingOptions(s types.ServiceConfig) nat.PortMap {
for _, port := range s.Ports {
p := nat.Port(fmt.Sprintf("%d/%s", port.Target, port.Protocol))
bind := []nat.PortBinding{}
binding := nat.PortBinding{}
binding := nat.PortBinding{
HostIP: port.HostIP,
}
if port.Published > 0 {
binding.HostPort = fmt.Sprint(port.Published)
}