Merge pull request #14290 from kgibm/issue12658
Special case port mapping publish on macOSpull/14177/head
commit
c099c054b2
|
@ -488,8 +488,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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue