mirror of https://github.com/docker/docker-py.git
Fix for #1815: make APIClient.stop honor container StopTimeout value
Signed-off-by: Damien Nadé <anvil.github@livna.org>
This commit is contained in:
parent
1d6b5b2032
commit
f3dbd017f8
|
@ -1112,19 +1112,25 @@ class ContainerApiMixin(object):
|
||||||
json=True)
|
json=True)
|
||||||
|
|
||||||
@utils.check_resource('container')
|
@utils.check_resource('container')
|
||||||
def stop(self, container, timeout=10):
|
def stop(self, container, timeout=None):
|
||||||
"""
|
"""
|
||||||
Stops a container. Similar to the ``docker stop`` command.
|
Stops a container. Similar to the ``docker stop`` command.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
container (str): The container to stop
|
container (str): The container to stop
|
||||||
timeout (int): Timeout in seconds to wait for the container to
|
timeout (int): Timeout in seconds to wait for the container to
|
||||||
stop before sending a ``SIGKILL``. Default: 10
|
stop before sending a ``SIGKILL``. If None, then the
|
||||||
|
StopTimeout value of the container will be used.
|
||||||
|
Default: None
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:py:class:`docker.errors.APIError`
|
:py:class:`docker.errors.APIError`
|
||||||
If the server returns an error.
|
If the server returns an error.
|
||||||
"""
|
"""
|
||||||
|
if timeout is None:
|
||||||
|
params = {}
|
||||||
|
timeout = 10
|
||||||
|
else:
|
||||||
params = {'t': timeout}
|
params = {'t': timeout}
|
||||||
url = self._url("/containers/{0}/stop", container)
|
url = self._url("/containers/{0}/stop", container)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue