diff --git a/pkg/kubelet/dockertools/docker.go b/pkg/kubelet/dockertools/docker.go index ea1390817e1d8..956c3d2ee81e2 100644 --- a/pkg/kubelet/dockertools/docker.go +++ b/pkg/kubelet/dockertools/docker.go @@ -676,8 +676,10 @@ func GetDockerPodStatus(client DockerInterface, manifest api.PodSpec, podFullNam if result.err != nil { return nil, err } + // Add user container information - if dockerContainerName == PodInfraContainerName { + if dockerContainerName == PodInfraContainerName && + result.status.State.Running != nil { // Found network container podStatus.PodIP = result.ip } else { @@ -685,6 +687,9 @@ func GetDockerPodStatus(client DockerInterface, manifest api.PodSpec, podFullNam } } + if podStatus.PodIP == "" { + return nil, ErrNoPodInfraContainerInPod + } if len(statuses) == 0 && podStatus.PodIP == "" { return nil, ErrNoContainersInPod }