From 6b98ddfb1e29388a811c727a26b6f6c7cad7175e Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Tue, 22 Aug 2017 09:03:31 -0400 Subject: [PATCH] Allow retry of 500 API errors to be handled by restart policies --- client/driver/docker.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index 7a5cf401d0c..f1f324639ba 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -666,7 +666,7 @@ func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (*StartRespon if err := d.startContainer(container); err != nil { d.logger.Printf("[ERR] driver.docker: failed to start container %s: %s", container.ID, err) pluginClient.Kill() - return nil, fmt.Errorf("Failed to start container %s: %s", container.ID, err) + return nil, structs.NewRecoverableError(fmt.Errorf("Failed to start container %s: %s", container.ID, err), structs.IsRecoverable(err)) } // InspectContainer to get all of the container metadata as @@ -1384,6 +1384,7 @@ START: time.Sleep(1 * time.Second) goto START } + return structs.NewRecoverableError(startErr, true) } return recoverableErrTimeouts(startErr)