Created
October 28, 2015 18:42
-
-
Save buth/a6d2144b779375354ec2 to your computer and use it in GitHub Desktop.
Bash function for setting the Docker machine environment.
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
dm() { | |
status=$(docker-machine status dev) | |
if [ $? -ne 0 ]; then | |
echo "Got an error trying to get VM status" | |
return | |
fi | |
case $status in | |
Stopped) | |
docker-machine start dev | |
;; | |
Running) | |
echo "VM is already running" | |
;; | |
*) | |
echo "Got status: $status" | |
return | |
;; | |
esac | |
echo "Setting Docker env" | |
eval "$(docker-machine env dev)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment