Last active
June 17, 2017 18:21
-
-
Save misraX/c3439a29767304298cade52f32648d93 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
##### | |
#mmm, misraX | |
##### Automatically stop all docker containers ########## | |
# Loop over containeres, awk the first col "CONTAINER" | |
# exclude the string that start with ! /CONT/ to exclude CONTAINER ID | |
# as it's an invalid container ID. | |
for i in $(docker ps | awk '! /CONT/ {print $1}') | |
do | |
# Stop containers by ID | |
docker stop "$i" && echo "docker stopped" "$i" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment