mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
fix: 解决容器端口的显示问题 (#6417)
This commit is contained in:
parent
ab825a1a70
commit
dff0375848
@ -187,7 +187,7 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro
|
|||||||
IsFromApp = true
|
IsFromApp = true
|
||||||
}
|
}
|
||||||
|
|
||||||
exposePorts, _ := loadContainerPort(item.ID, client)
|
exposePorts := transPortToStr(records[i].Ports)
|
||||||
info := dto.ContainerInfo{
|
info := dto.ContainerInfo{
|
||||||
ContainerID: item.ID,
|
ContainerID: item.ID,
|
||||||
CreateTime: time.Unix(item.Created, 0).Format(constant.DateTimeLayout),
|
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,
|
ImageName: item.Image,
|
||||||
State: item.State,
|
State: item.State,
|
||||||
RunTime: item.Status,
|
RunTime: item.Status,
|
||||||
Ports: transPortToStr(exposePorts),
|
Ports: exposePorts,
|
||||||
IsFromApp: IsFromApp,
|
IsFromApp: IsFromApp,
|
||||||
IsFromCompose: IsFromCompose,
|
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)
|
data.ExposedPorts = loadContainerPortForInfo(exposePorts)
|
||||||
networkSettings := oldContainer.NetworkSettings
|
networkSettings := oldContainer.NetworkSettings
|
||||||
bridgeNetworkSettings := networkSettings.Networks[data.Network]
|
bridgeNetworkSettings := networkSettings.Networks[data.Network]
|
||||||
@ -1214,7 +1214,7 @@ func loadVolumeBinds(binds []types.MountPoint) []dto.VolumeHelper {
|
|||||||
return datas
|
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)
|
container, err := client.ContainerInspect(context.Background(), id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user