Skip to content

Instantly share code, notes, and snippets.

@aburnett
Created February 13, 2015 14:00
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 aburnett/093399cb2e65292e1679 to your computer and use it in GitHub Desktop.
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
#!/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 $@
}
@aburnett
Copy link
Author

Basically just wraps the docker command. Just use docker as normal and this will ensure the environment is set up.

@wlopez
Copy link

wlopez commented Feb 13, 2015

Thanks Adam!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment