diff --git a/server/container.go b/server/container.go index 48ad9363..5833d4cc 100644 --- a/server/container.go +++ b/server/container.go @@ -99,6 +99,10 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq s.addContainer(container) + if err := s.ctrIDIndex.Add(containerID); err != nil { + return nil, err + } + return &pb.CreateContainerResponse{ ContainerId: &containerID, }, nil @@ -397,6 +401,10 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq s.releaseContainerName(c.Name()) s.removeContainer(c) + if err := s.ctrIDIndex.Delete(c.ID()); err != nil { + return nil, err + } + return &pb.RemoveContainerResponse{}, nil }