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 }