Best way to stop all docker containers on a host

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Jeggs101

Well-Known Member
Dec 29, 2010
1,529
241
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
12,511
5,792
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.