mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f963500c54
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> |
||
---|---|---|
.. | ||
backend | ||
blkiodev | ||
container | ||
events | ||
filters | ||
image | ||
mount | ||
network | ||
plugins/logdriver | ||
registry | ||
strslice | ||
swarm | ||
time | ||
versions | ||
volume | ||
auth.go | ||
client.go | ||
configs.go | ||
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 | ||
volume.go |