From 14bc3697c86f97eab7d24033f9e178101be329cf Mon Sep 17 00:00:00 2001 From: ngtuna Date: Fri, 22 Jul 2016 23:40:26 +0700 Subject: [PATCH] close #60 --- cli/app/app.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/app/app.go b/cli/app/app.go index fca4b403..e94e2319 100644 --- a/cli/app/app.go +++ b/cli/app/app.go @@ -506,6 +506,9 @@ func configPorts(name string, service ServiceConfig) []api.ContainerPort { func configServicePorts(name string, service ServiceConfig) []api.ServicePort { servicePorts := []api.ServicePort{} for _, port := range service.Port { + if port.HostPort == 0 { + port.HostPort = port.ContainerPort + } var p api.Protocol switch port.Protocol { default: @@ -516,12 +519,12 @@ func configServicePorts(name string, service ServiceConfig) []api.ServicePort { p = api.ProtocolUDP } var targetPort intstr.IntOrString - targetPort.IntVal = port.HostPort - targetPort.StrVal = strconv.Itoa(int(port.HostPort)) + targetPort.IntVal = port.ContainerPort + targetPort.StrVal = strconv.Itoa(int(port.ContainerPort)) servicePorts = append(servicePorts, api.ServicePort{ - Name: strconv.Itoa(int(port.ContainerPort)), + Name: strconv.Itoa(int(port.HostPort)), Protocol: p, - Port: port.ContainerPort, + Port: port.HostPort, TargetPort: targetPort, }) }