driver/docker: stopping a dead container not error

This commit is contained in:
Mahmood Ali
2018-12-15 14:30:29 -05:00
parent 2502ffe589
commit f248fefdbf
2 changed files with 10 additions and 0 deletions

View File

@@ -20,6 +20,10 @@ const (
// does not exist.
NoSuchContainerError = "No such container"
// ContainerNotRunningError is returned by the docker daemon if the container
// is not running, yet we requested it to stop
ContainerNotRunningError = "Container not running"
// pluginName is the name of the plugin
pluginName = "docker"

View File

@@ -148,6 +148,12 @@ func (h *taskHandle) Kill(killTimeout time.Duration, signal os.Signal) error {
h.logger.Debug("attempted to stop nonexistent container")
return nil
}
// Container has already been stopped.
if strings.Contains(err.Error(), ContainerNotRunningError) {
h.logger.Debug("attempted to stop an not-running container")
return nil
}
h.logger.Error("failed to stop container", "error", err)
return fmt.Errorf("Failed to stop container %s: %s", h.containerID, err)
}