diff --git a/pkg/container/client.go b/pkg/container/client.go index f534bd0b3..3a04f5ffd 100644 --- a/pkg/container/client.go +++ b/pkg/container/client.go @@ -157,6 +157,15 @@ func (client dockerClient) GetContainer(containerID t.ContainerID) (Container, e return Container{}, err } + containerNetworkMode := strings.Split(string(containerInfo.HostConfig.NetworkMode), ":") + if len(containerNetworkMode) == 2 { + parentContainer, err := client.api.ContainerInspect(bg, containerNetworkMode[1]) + if err != nil { + log.Debug("Unable to fetch parentContainer.") + } + containerInfo.HostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", parentContainer.Name)) + } + imageInfo, _, err := client.api.ImageInspectWithRaw(bg, containerInfo.Image) if err != nil { log.Warnf("Failed to retrieve container image info: %v", err)