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

compose down: add [SERVICE...] argument #10230

Closed
Excpt0r opened this issue Feb 2, 2023 · 2 comments · Fixed by #10552
Closed

compose down: add [SERVICE...] argument #10230

Excpt0r opened this issue Feb 2, 2023 · 2 comments · Fixed by #10552

Comments

@Excpt0r
Copy link

Excpt0r commented Feb 2, 2023

Description

Most compose subcommands support an optional list of services to operate with, instead of all compose services.
Is there a good reason why the down command behaves differently?

My use case:
Stop a single service of the compose stack, AND remove all corresponding named volumes with it.

A close workaround would be to use compose stop && compose rm -v - but this works only for anonymous volumes, not named volumes.
So in addition to the [SERVICE...] argument for compose down, maybe it would also be nice and consistent to have an additional flag for the compose rm to also include named volumes, when needed (not my use case).

@ndeloof
Copy link
Contributor

ndeloof commented Feb 6, 2023

no specific reason, you're welcome to propose a pull-request if you feel confident with Go development :)

@Excpt0r
Copy link
Author

Excpt0r commented Feb 9, 2023

@ndeloof thanks for your response.
I had a look, but this change will probably require more than just adding some cmd flags, so no PR from my side, sorry.

The only workaround I see so far, is to use "docker volume rm" for the corresponding name volumes.
But that requires of course that the volume cleanup process knows the mapping between services and their volumes.
During runtime this could be retrieved by "docker container inspect", but deleting volumes from services that are currently not running/created would require to get the info from compose.yml.

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

Successfully merging a pull request may close this issue.

2 participants