Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of auto_remove and remove param #3289

Open
Victor725 opened this issue Sep 20, 2024 · 1 comment
Open

Usage of auto_remove and remove param #3289

Victor725 opened this issue Sep 20, 2024 · 1 comment

Comments

@Victor725
Copy link

When using client.containers.run(), we can determine parameters such as image, command, ...
I wander what the difference between auto_remove and remove?
In Official Document, auto_remove defined as:

auto_remove (bool) – enable auto-removal of the container on daemon side when the container’s process exits.

remove defined as:

remove (bool) – Remove the container when it has finished running. Default: False.
@Levii22
Copy link

Levii22 commented Sep 28, 2024

The auto_remove option automatically deletes the container when it exits, managed by the Docker daemon, while remove manually removes the container after it finishes running.

In simple terms: auto_remove is handled by the daemon while remove is handled by the code.

container.start()
...
if remove:
    container.remove()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants