Open
Description
Problem Statement
Currently, stopping multiple containers requires explicitly listing them or using shell commands to pipe docker ps
output. This creates friction for developers and operators who frequently need to stop all running containers during development or cleanup operations.
Proposed Solution
Add an --all
flag to docker container stop
that allows stopping all running containers in a single command. This aligns with existing Docker CLI patterns (e.g., docker container rm -a
) and provides a more convenient workflow.
Benefits
- Improved developer experience by reducing command complexity
- Consistency with other Docker commands that support bulk operations
- Reduced risk of typos when manually listing container IDs
- Better automation support for cleanup scripts
Implementation Details
- Add
--all/-a
flag to stop command options - When
--all
is specified, fetch all running containers and stop them - Maintain existing timeout and signal handling
- Preserve current behavior when
--all
is not specified
Backwards Compatibility
This change is fully backwards compatible as it only adds a new optional flag.
Am happy to contribute if this enhancement request gets approved!