From d257a63fb6a2ad0c2369981914544add389917bf Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Thu, 29 Jun 2017 15:25:17 -0700 Subject: [PATCH] daemon: Ignore nonexistent containers when listing containers The name/ID relationships are maintained separately from the memdb and can be out of sync from any particular memdb snapshot. If a container does not exist in the memdb, we must accept this as normal and not fail the listing. This is consistent with what the code used to do before memdb was introduced. Signed-off-by: Aaron Lehmann Signed-off-by: Sebastiaan van Stijn --- daemon/list.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/daemon/list.go b/daemon/list.go index 870a7bda2d..b854be7549 100644 --- a/daemon/list.go +++ b/daemon/list.go @@ -162,11 +162,13 @@ func (daemon *Daemon) filterByNameIDMatches(view container.View, ctx *listContex cntrs := make([]container.Snapshot, 0, len(matches)) for id := range matches { c, err := view.Get(id) - if err != nil { - return nil, err - } - if c != nil { + switch err.(type) { + case nil: cntrs = append(cntrs, *c) + case container.NoSuchContainerError: + // ignore error + default: + return nil, err } }