ContainerExecAttach used `types.ExecConfig` instead of `types.ExecStartCheck`,
which is the type that's expected by the `/exec/execid/start` API endpoint.
Investigating when this inconsistency was introduced, I found that the client has
sent the additional properties since its first imlpementation in
c786a8ee5e9db8f5f609cf8721bd1e1513fb0043.
The `postContainerExecStart()` at that time used the "jobs" package, which
only took the information from the body that was needed (`Detach` and `Tty`).
Commit 24425021d26f29a475702064181e6c99fb6bd1c5 refactored the Exec commands
to remove the "jobs", and introduced the `ExecStartCheck` type, but failed to
update the `cli.hijack()` call with the new type.
The change in this patch should not affect compatibility with older clients,
as the additional information from the `ExecConfig` type is not used (the
API server already decodes to the `ExecStartCheck` type).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -35,7 +35,7 @@ func (cli *Client) ContainerExecStart(ctx context.Context, execID string, config |
| 35 | 35 |
// It returns a types.HijackedConnection with the hijacked connection |
| 36 | 36 |
// and the a reader to get output. It's up to the called to close |
| 37 | 37 |
// the hijacked connection by calling types.HijackedResponse.Close. |
| 38 |
-func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) {
|
|
| 38 |
+func (cli *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) {
|
|
| 39 | 39 |
headers := map[string][]string{"Content-Type": {"application/json"}}
|
| 40 | 40 |
return cli.postHijacked(ctx, "/exec/"+execID+"/start", nil, config, headers) |
| 41 | 41 |
} |
| ... | ... |
@@ -45,7 +45,7 @@ type ContainerAPIClient interface {
|
| 45 | 45 |
ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.IDResponse, error) |
| 46 | 46 |
ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) |
| 47 | 47 |
ContainerDiff(ctx context.Context, container string) ([]container.ContainerChangeResponseItem, error) |
| 48 |
- ContainerExecAttach(ctx context.Context, execID string, config types.ExecConfig) (types.HijackedResponse, error) |
|
| 48 |
+ ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error) |
|
| 49 | 49 |
ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) |
| 50 | 50 |
ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error) |
| 51 | 51 |
ContainerExecResize(ctx context.Context, execID string, options types.ResizeOptions) error |