From 7516dfd8c5185346c49ab899f41c080547c3d107 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 8 Mar 2018 14:48:47 -0500 Subject: Fix a potential race around container removal in ps Signed-off-by: Matthew Heon Closes: #467 Approved by: baude --- cmd/podman/ps.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cmd/podman') diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 26991af4b..4dd7133bc 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -405,6 +405,14 @@ func getTemplateOutput(containers []*libpod.Container, opts psOptions) ([]psTemp for _, ctr := range containers { batchInfo, err := batchContainerOp(ctr, opts) if err != nil { + // If the error was ErrNoSuchCtr, it was probably + // removed sometime after we got the initial list. + // Just ignore it. + if errors.Cause(err) == libpod.ErrNoSuchCtr { + logrus.Debugf("Container %s removed before batch, ignoring in output", ctr.ID()) + continue + } + return nil, err } ctrID := ctr.ID() -- cgit v1.2.3-54-g00ecf