r"""stop the Docker container. Args: remove (Optional[bool]): Whether to remove the container after stopping it. (default: :obj: `None`) Returns: DockerRuntime: The DockerRuntime instance.
(self, remove: Optional[bool] = None)
| 326 | return self.stop().build() |
| 327 | |
| 328 | def stop(self, remove: Optional[bool] = None) -> "DockerRuntime": |
| 329 | r"""stop the Docker container. |
| 330 | |
| 331 | Args: |
| 332 | remove (Optional[bool]): Whether to remove the container |
| 333 | after stopping it. (default: :obj: `None`) |
| 334 | |
| 335 | Returns: |
| 336 | DockerRuntime: The DockerRuntime instance. |
| 337 | """ |
| 338 | if self.container: |
| 339 | self.container.stop() |
| 340 | if remove is None: |
| 341 | remove = self.remove |
| 342 | if remove: |
| 343 | logger.info("Removing container.") |
| 344 | self.container.remove() |
| 345 | self.container = None |
| 346 | else: |
| 347 | logger.warning("No container to stop.") |
| 348 | return self |
| 349 | |
| 350 | @property |
| 351 | def ok(self) -> bool: |