ansible-test - Use `-t` for container stop timeout (#85019)

pull/85060/head
Matt Clay 7 months ago committed by GitHub
parent aab732cb82
commit 0aa8afbaf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
minor_changes:
- ansible-test - Use the ``-t`` option to set the stop timeout when stopping a container.
This avoids use of the ``--time`` option which was deprecated in Docker v28.0.

@ -722,9 +722,10 @@ def docker_rm(args: CommonConfig, container_id: str) -> None:
"""Remove the specified container."""
try:
# Stop the container with SIGKILL immediately, then remove the container.
# Podman supports the `--time` option on `rm`, but only since version 4.0.0.
# Docker does not support the `--time` option on `rm`.
docker_command(args, ['stop', '--time', '0', container_id], capture=True)
# Docker supports `--timeout` for stop. The `--time` option was deprecated in v28.0.
# Podman supports `--time` for stop. The `--timeout` option was deprecated in 1.9.0.
# Both Docker and Podman support the `-t` option for stop.
docker_command(args, ['stop', '-t', '0', container_id], capture=True)
docker_command(args, ['rm', container_id], capture=True)
except SubprocessError as ex:
# Both Podman and Docker report an error if the container does not exist.

Loading…
Cancel
Save