From fd169c00bf19a392276d52867c1a5032d22b7b21 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Thu, 11 Jul 2019 13:58:15 -0700 Subject: [PATCH] Propagate GetContainer error from event processor Before this change we just accept that any error is "not found" and it could be something else, but even if it it is just a "not found" kind of error this should be dealt with from the container store and not the event processor. Signed-off-by: Brian Goff (cherry picked from commit 54e30a62d3ca39c912c8e291e80cfbf80860d607) Signed-off-by: Sebastiaan van Stijn --- daemon/monitor.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/daemon/monitor.go b/daemon/monitor.go index 2f47497f44..c294742884 100644 --- a/daemon/monitor.go +++ b/daemon/monitor.go @@ -2,8 +2,6 @@ package daemon // import "github.com/docker/docker/daemon" import ( "context" - "errors" - "fmt" "runtime" "strconv" "time" @@ -12,6 +10,7 @@ import ( "github.com/docker/docker/container" libcontainerdtypes "github.com/docker/docker/libcontainerd/types" "github.com/docker/docker/restartmanager" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -29,8 +28,8 @@ func (daemon *Daemon) setStateCounter(c *container.Container) { // ProcessEvent is called by libcontainerd whenever an event occurs func (daemon *Daemon) ProcessEvent(id string, e libcontainerdtypes.EventType, ei libcontainerdtypes.EventInfo) error { c, err := daemon.GetContainer(id) - if c == nil || err != nil { - return fmt.Errorf("no such container: %s", id) + if err != nil { + return errors.Wrapf(err, "could not find container %s", id) } switch e {