Last active
November 7, 2023 03:40
-
-
Save evanscottgray/8571828 to your computer and use it in GitHub Desktop.
kill all docker containers at once...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt |
docker rm -f $(docker ps -a -q)
@eenchev completely agree. When I wrote this like six years ago, I had no idea what I was doing. 😅
...and some would argue that not much has changed!
These days I use something closer to docker ps -qa | xargs docker stop
.
docker container stop $(docker container ls -q)
thanks, worked like a charm !!
All didn't work for me
I used docker stop $(docker ps -a -q)
All did n't work for me
I used
docker stop $(docker ps -a -q)
docker kill, not stop
doing it like this:
https://gist.github.com/digitalist/abf3320fa5ad937015cca15920e25acc
sudo docker kill $(sudo docker ps -q)
Why not something like docker stopall
?
docker kill $(sudo docker ps -q)
This is great, thanks @webdev23 !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to be a hipster and stop all running containers using the management commands than use this.
docker container stop $(docker container ls -q)