Last active
September 9, 2015 21:15
-
-
Save khornberg/1b9dae44d65f126dd01f to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Redefined the docker command to connect if the shell has not already | |
# done so. This speeds up the shell start up. | |
docker() { | |
if [ "$DOCKER_HOST" = "" ]; then | |
# Setup docker | |
if [ -x /usr/local/bin/docker-machine ]; then | |
# suppress standard out | |
eval "docker-machine env default --shell=bash >/dev/null" | |
S=$? | |
# If an error occurs try staring the VM | |
if [ $S -ne 0 ]; then | |
echo "Starting the VM" | |
eval "docker-machine start default" | |
eval "$(docker-machine env default --shell=bash)" | |
else | |
eval "$(docker-machine env default --shell=bash)" | |
fi | |
fi | |
/usr/local/bin/docker $@ # do the command passed | |
else | |
/usr/local/bin/docker $@ | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment