Browse Source

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.
pull/3621/head
Frank Schroeder 7 years ago
parent
commit
51a18c2557
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
  1. 2
      agent/checks/docker.go

2
agent/checks/docker.go

@ -155,7 +155,7 @@ func (c *DockerClient) StartExec(containerID, execID string) (*circbuf.Buffer, e
uri := fmt.Sprintf("/exec/%s/start", execID) uri := fmt.Sprintf("/exec/%s/start", execID)
b, code, err := c.call("POST", uri, data) b, code, err := c.call("POST", uri, data)
switch { 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) return nil, fmt.Errorf("start exec failed for container %s: %s", containerID, err)
case code == 200: case code == 200:
return b, nil return b, nil

Loading…
Cancel
Save