moby--moby/api/types
Kir Kolyshkin f963500c54 ContainerWait on remove: don't stuck on rm fail
Currently, if a container removal has failed for some reason,
any client waiting for removal (e.g. `docker run --rm`) is
stuck, waiting for removal to succeed while it has failed already.
For more details and the reproducer, please check
https://github.com/moby/moby/issues/34945

This commit addresses that by allowing `ContainerWait()` with
`container.WaitCondition == "removed"` argument to return an
error in case of removal failure. The `ContainerWaitOKBody`
stucture returned to a client is amended with a pointer to `struct Error`,
containing an error message string, and the `Client.ContainerWait()`
is modified to return the error, if any, to the client.

Note that this feature is only available for API version >= 1.34.
In order for the old clients to be unstuck, we just close the connection
without writing anything -- this causes client's error.

Now, docker-cli would need a separate commit to bump the API to 1.34
and to show an error returned, if any.

[v2: recreate the waitRemove channel after closing]
[v3: document; keep legacy behavior for older clients]
[v4: convert Error from string to pointer to a struct]
[v5: don't emulate old behavior, send empty response in error case]
[v6: rename legacy* vars to include version suffix]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-10-25 13:11:56 -07:00
..
backend LCOW: API: Add platform to /images/create and /build 2017-10-06 11:44:18 -07:00
blkiodev
container ContainerWait on remove: don't stuck on rm fail 2017-10-25 13:11:56 -07:00
events
filters
image
mount
network
plugins/logdriver
registry
strslice
swarm
time
versions
volume
auth.go
client.go LCOW: API change JSON header to string POST parameter 2017-10-06 15:26:48 -07:00
configs.go LCOW: API: Add platform to /images/create and /build 2017-10-06 11:44:18 -07:00
error_response.go
graph_driver_data.go
id_response.go
image_delete_response_item.go
image_summary.go
plugin.go
plugin_device.go
plugin_env.go
plugin_interface_type.go
plugin_mount.go
plugin_responses.go
port.go
seccomp.go
service_update_response.go
stats.go
types.go Fix downlevel regression 2017-10-09 13:47:28 -07:00
volume.go