Last active
August 29, 2015 14:23
-
-
Save tobinski/49842ce940cdc73df926 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sudo ./shell.sh mapserver |
This file contains hidden or 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/bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
string="$1" | |
if [ -z $string ]; then | |
# default container | |
string="fpm" | |
fi | |
for i in $(sudo docker ps | grep $string | cut -f1 -d" "); | |
do | |
docker exec -ti $i /bin/bash -l | |
break | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment