Feature: docker rm --all --force Command
Description
I’d like to suggest adding an -a, --all option to the docker rm command. With this we could do commands like docker rm --all --force. It would allow us to remove all containers, both running and stopped, with a single command. Currently, we have to stop them first and then remove them, which feels a bit clunky.
Podman has this functionality built in. Adding this option to Docker would streamline the process and improve the user experience.
References
- https://docs.docker.com/reference/cli/docker/container/rm/
- https://docs.podman.io/en/latest/markdown/podman-rm.1.html
related to / (partial) duplicate of;
- https://github.com/docker/cli/issues/3622
- https://github.com/docker/cli/issues/3565
- https://github.com/docker/cli/issues/1679
- https://github.com/docker/cli/issues/5930
- https://github.com/docker/cli/pull/3580
I think this one still needs a wider discussion, because these commands were primarily designed to interact on a single containers, or a list of containers provided as argument. Performing batch operations is somewhat conflicting with that design, which is why this was not implemented originally (besides the potential risk of a single flag being a bit of a "foot-gun" and a destructive operation).
I find myself doing docker stop $(docker ps -q) and docker rm $(docker ps -aq) probably to the point where I should've created a shell alias by now, so I do think we should look into. Nonetheless, it might make sense to see where we should implement it, as it could make sense to do it engine-side.
@schuerg @thaJeztah is this issue open to contribute ?
+1, I'd love to submit a PR for this
because these commands were primarily designed to interact on a single containers
How about docker container prune --all -f ? (adding the --all flag)