set PortBinding HostIP

close https://github.com/docker/compose-cli/issues/1403

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-03-17 14:05:03 +01:00
parent 0108cc5727
commit 8f7e7abc6c
No known key found for this signature in database
GPG Key ID: 9858809D6F8F6E7E
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)
}