compose-spec icon indicating copy to clipboard operation
compose-spec copied to clipboard

Allow Automatic Removal of Container On Exit in Spec

Open d42ohpaz opened this issue 3 years ago • 2 comments

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.

  • no would mean that the container would not be removed automatically under any circumstances
  • always would remove the container irrespective of exit status or other condition
  • on-success would only remove the container when its exit status is 0

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.

d42ohpaz avatar Sep 22 '22 15:09 d42ohpaz

Hi @9ae8sdf76 👋 Thank you for suggesting this idea!

EricHripko avatar Oct 15 '22 09:10 EricHripko