From 8f7e7abc6cd4d5a1c6f15c19f976f391cc053b0f Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 17 Mar 2021 14:05:03 +0100 Subject: [PATCH] set PortBinding HostIP close https://github.com/docker/compose-cli/issues/1403 Signed-off-by: Nicolas De Loof --- local/compose/create.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/local/compose/create.go b/local/compose/create.go index d3d40b30d..54dd12ca6 100644 --- a/local/compose/create.go +++ b/local/compose/create.go @@ -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) }