From 8073427f76b05e9617c5782e4f3146a8a38738ef Mon Sep 17 00:00:00 2001 From: Harry Zhang Date: Sun, 11 Dec 2016 16:25:17 +0800 Subject: [PATCH] Fix panic create container when sb is fail Signed-off-by: Harry Zhang --- server/container_create.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/container_create.go b/server/container_create.go index 4638ef27..ee855d19 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -271,6 +271,10 @@ func (s *Server) createSandboxContainer(containerID string, containerName string // Join the namespace paths for the pod sandbox container. podInfraState := s.runtime.ContainerStatus(sb.infraContainer) + if podInfraState == nil { + return nil, fmt.Errorf("state of infra container of given sandbox: %q is nil, which is unexpected", sb.metadata.GetName()) + } + logrus.Debugf("pod container state %+v", podInfraState) for nsType, nsFile := range map[string]string{