From 12276b66de5935535e570db692d4d43b2d7d1f22 Mon Sep 17 00:00:00 2001 From: Tony Holdstock-Brown Date: Mon, 16 Nov 2015 00:13:34 -0800 Subject: [PATCH 1/2] Fix exec resize - it was prepending URL to the path which broke the call --- dockerclient.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerclient.go b/dockerclient.go index d8379fb..b9a98d6 100644 --- a/dockerclient.go +++ b/dockerclient.go @@ -328,7 +328,7 @@ func (client *DockerClient) ExecResize(id string, width, height int) error { v.Set("h", h) uri := fmt.Sprintf("/%s/exec/%s/resize?%s", APIVersion, id, v.Encode()) - if _, err := client.doRequest("POST", client.URL.String()+uri, nil, nil); err != nil { + if _, err := client.doRequest("POST", uri, nil, nil); err != nil { return err } From 9829316c9219e6ad9c304d8d916db238f08e3cf4 Mon Sep 17 00:00:00 2001 From: Tony Holdstock-Brown Date: Mon, 16 Nov 2015 00:26:14 -0800 Subject: [PATCH 2/2] Also implement ContainerResize along ExecResize --- dockerclient.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dockerclient.go b/dockerclient.go index b9a98d6..f80027e 100644 --- a/dockerclient.go +++ b/dockerclient.go @@ -319,6 +319,14 @@ func (client *DockerClient) ExecStart(id string, config *ExecConfig) error { } func (client *DockerClient) ExecResize(id string, width, height int) error { + return client.resize("exec", id, width, height) +} + +func (client *DockerClient) ContainerResize(id string, width, height int) error { + return client.resize("containers", id, width, height) +} + +func (client *DockerClient) resize(mode, id string, width, height int) error { v := url.Values{} w := strconv.Itoa(width) @@ -327,7 +335,7 @@ func (client *DockerClient) ExecResize(id string, width, height int) error { v.Set("w", w) v.Set("h", h) - uri := fmt.Sprintf("/%s/exec/%s/resize?%s", APIVersion, id, v.Encode()) + uri := fmt.Sprintf("/%s/%s/%s/resize?%s", APIVersion, mode, id, v.Encode()) if _, err := client.doRequest("POST", uri, nil, nil); err != nil { return err }