docker / docker/cli

Feature: `docker kill --all` terminate all containers at once

Open
#3,565 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

As a user when I'm building new projects I tend to spin up and kill a lot of containers for troubleshooting purposes.

Typically I do something like this alias dka='docker kill $(docker ps -q)', but I wonder why there isn't a flag for either docker stop or docker kill that does this.

If docker ps -q returns nothing, then naturally docker kill will display the help. Thus extra steps are needed in scripting to avoid this output.

Proposal

Could docker kill and/or docker stop have a -a/--all flag that terminates any available running containers? I imagine the -s flag could be used in combination like docker kill -a -s SIGQUIT

Another option would be docker killall which would allow for more in depth options like killall. This isn't necessary for my use case though.

If this is a valid feature, I'd like to give it a shot at implementing it 👍

Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the docker kill command entry point and its existing -s signal option, then compare the docker stop command. Clarify whether --all belongs on kill, stop, or both, and how it behaves when no running containers exist. Done means the chosen command supports the documented flag and its behavior is covered by the relevant CLI tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.