docker: ignore "connection reset by peer"

The Docker agent closes the connection during read after we have
read the body. This causes a "connection reset by peer" even though
the command was successful.

We ignore that error here since we got the correct status code
and a response body.
This commit is contained in:
Frank Schroeder 2017-10-26 11:56:08 +02:00
parent 17213f6e8f
commit b907c4611d
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
1 changed files with 1 additions and 1 deletions

View File

@ -155,7 +155,7 @@ func (c *DockerClient) StartExec(containerID, execID string) (*circbuf.Buffer, e
uri := fmt.Sprintf("/exec/%s/start", execID)
b, code, err := c.call("POST", uri, data)
switch {
case err != nil:
case err != nil && !strings.Contains(err.Error(), "connection reset by peer"):
return nil, fmt.Errorf("start exec failed for container %s: %s", containerID, err)
case code == 200:
return b, nil