container_list: guard against list filter being nil
@@ -38,12 +38,14 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
logrus.Debugf("ListContainersRequest %+v", req)
var ctrs []*pb.Container
- filter := req.Filter
+ filter := req.GetFilter()
ctrList, err := s.ContainerServer.ListContainers()
if err != nil {
return nil, err
}
+ if filter != nil {
+
// Filter using container id and pod id first.
if filter.Id != "" {
id, err := s.CtrIDIndex().Get(filter.Id)
@@ -76,6 +78,7 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
}
}
}
+ }
for _, ctr := range ctrList {
podSandboxID := ctr.Sandbox()
