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

Feature request: Add COMPOSE_REMOVE_ORPHANS to let us default to --remove-orphans on a per project basis #9199

Closed
nickjj opened this issue Feb 23, 2022 · 0 comments · Fixed by #9200

Comments

@nickjj
Copy link

nickjj commented Feb 23, 2022

Hi,

I find myself always using docker-compose down --remove-orphans because if I rename a service or happen to have run a 1 off task and Docker created a container with a random suffix I always want to clean those containers up.

I recently ran a poll on Twitter asking what other folks prefer https://twitter.com/nickjanetakis/status/1495458224912351242 and ~83% said they would like to have --remove-orphans set by default. I even set this as the 2nd option in the poll to eliminate a bias where someone might just choose the first item in the poll.

But since that's a breaking change @ndeloof suggested that maybe we can add a new COMPOSE_REMOVE_ORPHANS environment variable that when set would remove orphans. This is nice because we can set a single environment once and have it happen by default on a per project basis without making any backwards incompatible changes.

What do you think?

The proposed behavior would be things continue to work as they do today but if you set COMPOSE_REMOVE_ORPHANS=1 or any value then it would remove orphans without needing to define --remove-orphans every time you run docker-compose down.

It would be nice if this were also applied to Docker Compose v1 because there's still issues with Docker Compose v2 where it doesn't parse YAML in the same way as Docker Compose v1 but that's a separate matter. I'm just trying to say that I still use v1.

Thanks!

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

Successfully merging a pull request may close this issue.

1 participant