gabrieldemarmiesse / python-on-whales

An awesome Python wrapper for an awesome Docker CLI!
MIT License
537 stars 100 forks source link

Function `docker.compose.down` does not accept optional list of service names #570

Closed MisterOwlPT closed 5 months ago

MisterOwlPT commented 5 months ago

Hi 😃

The Docker Compose CLI allows the command down to be passed a list of service names (similar to other commands up and rm).

$ docker compose down --help

Usage:  docker compose down [OPTIONS] **[SERVICES]**
Stop and remove containers, networks
...

I noticed that python_on_whales does not currently support this feature, which I personally need for a personal use case. Calling docker.compose.down() simply stops all declared service containers.

If you agree, I can submit a PR with a logic similar to this such that if service names are provided, then only the related containers are stopped. Otherwise, if no list of service names is provided, all service containers are stopped.

gabrieldemarmiesse commented 5 months ago

Thank you for opening this feature request! When I made the first iteration of python-on-whales, this was not available. Feel free to make a pull request, I'll take a look at it.

gabrieldemarmiesse commented 5 months ago

Closing as fixed by #571