Skip to content

Add --all flag to docker container stop command #5930

Open
@daviddl9

Description

@daviddl9

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

  1. Improved developer experience by reducing command complexity
  2. Consistency with other Docker commands that support bulk operations
  3. Reduced risk of typos when manually listing container IDs
  4. 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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions