From 517bae6910f8d30db9106de40dff2e7cedb32cfe Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:04:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=AB=AF=E5=8F=A3=E6=98=BE=E7=A4=BA=20(#2460?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/container.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 3c4af863d..bd6479584 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -955,9 +955,13 @@ func simplifyPort(ports []types.Port) []string { return datas } if len(ports) == 1 { - itemPortStr := fmt.Sprintf("%s:%v/%s", ports[0].IP, ports[0].PrivatePort, ports[0].Type) + ip := "" + if len(ports[0].IP) != 0 { + ip = ports[0].IP + ":" + } + itemPortStr := fmt.Sprintf("%s%v/%s", ip, ports[0].PrivatePort, ports[0].Type) if ports[0].PublicPort != 0 { - itemPortStr = fmt.Sprintf("%s:%v->%v/%s", ports[0].IP, ports[0].PublicPort, ports[0].PrivatePort, ports[0].Type) + itemPortStr = fmt.Sprintf("%s%v->%v/%s", ip, ports[0].PublicPort, ports[0].PrivatePort, ports[0].Type) } datas = append(datas, itemPortStr) return datas