From 7df74d3e4a6b00be1208b0d416c3a03ade8cf911 Mon Sep 17 00:00:00 2001 From: Kevin Grigorenko Date: Tue, 7 Jun 2022 09:24:21 -0500 Subject: [PATCH] Issue #12658: Special case port mapping publish on macOS Signed-off-by: Kevin Grigorenko --- pkg/drivers/kic/oci/oci.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index 9516af6b6f75..132e8dfee35c 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -472,8 +472,13 @@ func generatePortMappings(portMappings ...PortMapping) []string { for _, pm := range portMappings { // let docker pick a host port by leaving it as :: // example --publish=127.0.0.17::8443 will get a random host port for 8443 - publish := fmt.Sprintf("--publish=%s::%d", pm.ListenAddress, pm.ContainerPort) - result = append(result, publish) + if runtime.GOOS == "darwin" { + publish := fmt.Sprintf("--publish=%d", pm.ContainerPort) + result = append(result, publish) + } else { + publish := fmt.Sprintf("--publish=%s::%d", pm.ListenAddress, pm.ContainerPort) + result = append(result, publish) + } } return result }