mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
driver/docker: stopping a dead container not error
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user