Skip to content

Instantly share code, notes, and snippets.

@Streek
Created May 2, 2017 22:37
Show Gist options
  • Save Streek/d187a3e6ae0e12bd43c00d8369e83583 to your computer and use it in GitHub Desktop.
Save Streek/d187a3e6ae0e12bd43c00d8369e83583 to your computer and use it in GitHub Desktop.
Start or stop all docker containers.
#!/bin/bash
echo "Operation starting..."
if [[ $1 == "s" || $1 == "start" ]]; then
echo "--Starting All Docker Containers--"
docker start $(docker ps -a -q)
echo "All Containers Started..."
fi
if [[ $1 == "e" || $1 == "k" || $1 == "kill" || $1 == "stop" || $1 == "end" ]]; then
echo "--Killing All Docker Containers--"
docker stop $(docker ps -a -q)
echo "All Containers Killed..."
fi
echo "...Operation Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment