Allow Automatic Removal of Container On Exit in Spec
What is the problem you're trying to solve
Add to the spec the ability to specify that a container should be automatically removed (i.e., similar to docker compose run --rm ... on the CLI) when the container exits.
Describe the solution you'd like
The option would work like the restart policy, where the options would be no (default), always, and on-success.
-
nowould mean that the container would not be removed automatically under any circumstances -
alwayswould remove the container irrespective of exit status or other condition -
on-successwould only remove the container when its exit status is0
Manually stopping the container would have no effect.
Additional context My use case for this feature is that some containers need "shim" containers to run properly; e.g., disabling transparent huge pages for a redis container. While successful, Docker for Mac considers the app to be partially running because the shim is stopped, and only after manually removing the container will Docker for Mac show a green icon.
Thank you.
Hi @9ae8sdf76 👋 Thank you for suggesting this idea!