From c79b7a9d4738278ac332a88e13a53ca45c8c6527 Mon Sep 17 00:00:00 2001 From: Riccardo Paolo Bestetti Date: Fri, 10 Jan 2025 19:12:58 +0100 Subject: [PATCH 1/2] Remove the `remove` flag from docstring of Container.create() This commit removes the `remove` flag from the docstring entirely, as the create() operation doesn't support the `remove` flag. It is tolerated as an input because run() supports it and it internally calls the start() operation relaying its own kwargs. Signed-off-by: Riccardo Paolo Bestetti --- podman/domain/containers_create.py | 1 - 1 file changed, 1 deletion(-) diff --git a/podman/domain/containers_create.py b/podman/domain/containers_create.py index b2d5b824..c94171d5 100644 --- a/podman/domain/containers_create.py +++ b/podman/domain/containers_create.py @@ -225,7 +225,6 @@ def create( read_only (bool): Mount the container's root filesystem as read only. read_write_tmpfs (bool): Mount temporary file systems as read write, in case of read_only options set to True. Default: False - remove (bool): Remove the container when it has finished running. Default: False. restart_policy (Dict[str, Union[str, int]]): Restart the container when it exits. Configured as a dictionary with keys: From 7eaad537bcb811b38fb3e03ad2aab7ba71f23a89 Mon Sep 17 00:00:00 2001 From: Riccardo Paolo Bestetti Date: Fri, 10 Jan 2025 19:14:59 +0100 Subject: [PATCH 2/2] Update documentation for the `remove` flag in Container.run() This commit specifies more in depth the semantics of the `remove` flag of the run() operation: - it describes its interaction with detach=True - it clarifies that it is a client-initiated operation - it specifies that a similar daemon-side flag also exists with the name of `auto_remove` Signed-off-by: Riccardo Paolo Bestetti --- podman/domain/containers_run.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/podman/domain/containers_run.py b/podman/domain/containers_run.py index 0806994a..c20d807a 100644 --- a/podman/domain/containers_run.py +++ b/podman/domain/containers_run.py @@ -30,14 +30,17 @@ def run( By default, run() will wait for the container to finish and return its logs. If detach=True, run() will start the container and return a Container object rather - than logs. + than logs. In this case, if remove=True, run() will monitor and remove the + container after it finishes running; the logs will be lost in this case. Args: image: Image to run. command: Command to run in the container. stdout: Include stdout. Default: True. stderr: Include stderr. Default: False. - remove: Delete container when the container's processes exit. Default: False. + remove: Delete container on the client side when the container's processes exit. + The `auto_remove` flag is also available to manage the removal on the daemon + side. Default: False. Keyword Args: - See the create() method for keyword arguments.