From dff037584825af843b3716a6a4341176cbf3ed8d Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:26:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E7=9A=84=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#6417)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/container.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 431162b9b..bc97676a6 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -187,7 +187,7 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro IsFromApp = true } - exposePorts, _ := loadContainerPort(item.ID, client) + exposePorts := transPortToStr(records[i].Ports) info := dto.ContainerInfo{ ContainerID: item.ID, CreateTime: time.Unix(item.Created, 0).Format(constant.DateTimeLayout), @@ -196,7 +196,7 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro ImageName: item.Image, State: item.State, RunTime: item.Status, - Ports: transPortToStr(exposePorts), + Ports: exposePorts, IsFromApp: IsFromApp, IsFromCompose: IsFromCompose, } @@ -445,7 +445,7 @@ func (u *ContainerService) ContainerInfo(req dto.OperationWithName) (*dto.Contai } } - exposePorts, _ := loadContainerPort(oldContainer.ID, client) + exposePorts, _ := loadPortByInspect(oldContainer.ID, client) data.ExposedPorts = loadContainerPortForInfo(exposePorts) networkSettings := oldContainer.NetworkSettings bridgeNetworkSettings := networkSettings.Networks[data.Network] @@ -1214,7 +1214,7 @@ func loadVolumeBinds(binds []types.MountPoint) []dto.VolumeHelper { return datas } -func loadContainerPort(id string, client *client.Client) ([]types.Port, error) { +func loadPortByInspect(id string, client *client.Client) ([]types.Port, error) { container, err := client.ContainerInspect(context.Background(), id) if err != nil { return nil, err