Block until the container stops, then return its exit code. Similar to the ``docker wait`` command. Args: timeout (int): Request timeout condition (str): Wait until a container state reaches the given condition, either ``not-running``
(self, **kwargs)
| 505 | return self.client.api.update_container(self.id, **kwargs) |
| 506 | |
| 507 | def wait(self, **kwargs): |
| 508 | """ |
| 509 | Block until the container stops, then return its exit code. Similar to |
| 510 | the ``docker wait`` command. |
| 511 | |
| 512 | Args: |
| 513 | timeout (int): Request timeout |
| 514 | condition (str): Wait until a container state reaches the given |
| 515 | condition, either ``not-running`` (default), ``next-exit``, |
| 516 | or ``removed`` |
| 517 | |
| 518 | Returns: |
| 519 | (dict): The API's response as a Python dictionary, including |
| 520 | the container's exit code under the ``StatusCode`` attribute. |
| 521 | |
| 522 | Raises: |
| 523 | :py:class:`requests.exceptions.ReadTimeout` |
| 524 | If the timeout is exceeded. |
| 525 | :py:class:`docker.errors.APIError` |
| 526 | If the server returns an error. |
| 527 | """ |
| 528 | return self.client.api.wait(self.id, **kwargs) |
| 529 | |
| 530 | |
| 531 | class ContainerCollection(Collection): |
no outgoing calls