docker: add comment about "connection reset by peer" error

This commit is contained in:
Frank Schroeder 2017-10-26 12:14:19 +02:00
parent 7d05e55734
commit 712447026f
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
1 changed files with 6 additions and 0 deletions

View File

@ -162,6 +162,12 @@ 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 {
// todo(fs): https://github.com/hashicorp/consul/pull/3621
// todo(fs): for some reason the docker agent closes the connection during the
// todo(fs): io.Copy call in c.call which causes a "connection reset by peer" error
// todo(fs): even though both body and status code have been received. My current is
// todo(fs): that the docker agent closes this prematurely but I don't understand why.
// todo(fs): the code below ignores this error.
case err != nil && !strings.Contains(err.Error(), "connection reset by peer"): 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: