Created
February 13, 2015 14:00
-
-
Save aburnett/093399cb2e65292e1679 to your computer and use it in GitHub Desktop.
bash function to automatically ensure the boot2docker environment is up and running on OSX
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 | |
# start boot2docker and shellinit automatically | |
DOCKER_RUN=`which docker` | |
docker(){ | |
if ! /Applications/VirtualBox.app/Contents/MacOS/VBoxManage list runningvms | grep boot2docker-vm >/dev/null ; then | |
boot2docker start | |
fi | |
if [ "$DOCKER_HOST" == "" ]; then | |
$(boot2docker shellinit) | |
fi | |
$DOCKER_RUN $@ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basically just wraps the docker command. Just use docker as normal and this will ensure the environment is set up.