Created
June 3, 2015 20:45
-
-
Save ladyrassilon/31fa6877a9c24ae4e8f0 to your computer and use it in GitHub Desktop.
Add this to your bash script to avoid docker-machine env dev blocking your bash if dev isn't running
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
docker_running=$(docker-machine ls | grep dev) | |
if [[ "$docker_running" == *"Stopped"* ]] | |
then | |
echo "fyi - docker not running" | |
elif [[ "$docker_running" == *"Running"* ]] | |
then | |
eval "$(docker-machine env dev)" | |
fi |
๐
now I use something like this
docker_running=$(docker-machine ls | grep dev)
if [[ "$docker_running" == *"Stopped"* ]]
then
docker-machine start dev
eval "$(docker-machine env dev)"
env | grep "DOCKER_HOST"
elif [[ "$docker_running" == *"Running"* ]]
then
eval "$(docker-machine env dev)"
fi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
๐