1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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,251
    Likes Received:
    158
    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:
    10,044
    Likes Received:
    3,315
    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:
    4
    Likes Received:
    0
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