From 2501a9f78af373b8ee248eec6901def2a4556f6c Mon Sep 17 00:00:00 2001 From: John Bro <42930107+john1298308460@users.noreply.github.com> Date: Mon, 15 Apr 2024 15:12:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E6=9C=AA=E6=8C=87=E5=AE=9A=20IP=20=E7=BC=96=E8=BE=91=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=20(#4519)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/container.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/app/service/container.go b/backend/app/service/container.go index 92ca4a979..88769f711 100644 --- a/backend/app/service/container.go +++ b/backend/app/service/container.go @@ -416,10 +416,14 @@ func (u *ContainerService) ContainerInfo(req dto.OperationWithName) (*dto.Contai networkSettings := oldContainer.NetworkSettings bridgeNetworkSettings := networkSettings.Networks[data.Network] - ipv4Address := bridgeNetworkSettings.IPAMConfig.IPv4Address - ipv6Address := bridgeNetworkSettings.IPAMConfig.IPv6Address - data.Ipv4 = ipv4Address - data.Ipv6 = ipv6Address + if bridgeNetworkSettings.IPAMConfig != nil { + ipv4Address := bridgeNetworkSettings.IPAMConfig.IPv4Address + data.Ipv4 = ipv4Address + ipv6Address := bridgeNetworkSettings.IPAMConfig.IPv6Address + data.Ipv6 = ipv6Address + } else { + data.Ipv4 = bridgeNetworkSettings.IPAddress + } data.Cmd = oldContainer.Config.Cmd data.OpenStdin = oldContainer.Config.OpenStdin