Best way to stop all docker containers on a host

Discussion in 'Docker and Containers' started by Jeggs101, Oct 11, 2017.

  1. Jeggs101

    Jeggs101 Well-Known Member

    Joined:
    Dec 29, 2010
    Messages:
    1,402
    Likes Received:
    197
    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.
     
    #1
  2. Patrick

    Patrick Administrator
    Staff Member

    Joined:
    Dec 21, 2010
    Messages:
    11,050
    Likes Received:
    3,997
    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.
     
    #2
  3. Stankyjawnz

    Stankyjawnz New Member

    Joined:
    Aug 2, 2017
    Messages:
    11
    Likes Received:
    3
    #3
Similar Threads: Best stop
Forum Title Date
Docker and Containers What are the best methods to work with Docker ? May 23, 2017

Share This Page