Skip to content

Instantly share code, notes, and snippets.

@rafaeltuelho
Created December 3, 2014 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaeltuelho/7558bf1fe41c27ad964c to your computer and use it in GitHub Desktop.
Save rafaeltuelho/7558bf1fe41c27ad964c to your computer and use it in GitHub Desktop.
Issue a Docker command to all active containers
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 start|stop|pause|unpause|<any valid docker cmd>"
exit 1
fi
for c in $(sudo docker ps -a | awk '{print $1}' | sed "1 d")
do
sudo docker $1 $c
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment