Best way to stop all docker containers on a host

Jeggs101

Well-Known Member
Dec 29, 2010
1,484
222
63
What's the best method you've found to stop all docker containers on a host. I tried making consistent names but that's not what I want.
 

Patrick

Administrator
Staff member
Dec 21, 2010
11,908
4,871
113
Code:
docker stop $(docker ps -q)
You need the -q flag so it does not print header output and try to stop containers based on that header.