Skip to content

Instantly share code, notes, and snippets.

@buth
Created October 28, 2015 18:42
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 buth/a6d2144b779375354ec2 to your computer and use it in GitHub Desktop.
Save buth/a6d2144b779375354ec2 to your computer and use it in GitHub Desktop.
Bash function for setting the Docker machine environment.
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