-
-
Save machielg/6bca4394d26a39cc84bfa51688f42fa0 to your computer and use it in GitHub Desktop.
A wrapper shell script to use a virtualbox image for running the docker daemon on MacOS, uses docker-machine
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
#!/bin/bash | |
if ! [ -x "$(command -v docker-machine)" ]; then | |
echo 'docker-machine not installed' | |
brew install docker-machine | |
fi | |
if ! [ -x "$(command -v docker)" ]; then | |
echo 'docker client not installed' | |
brew install docker | |
fi | |
if ! docker-machine ls -q | grep -q 'vb-box'; then | |
echo 'creating machine' | |
docker-machine create -d virtualbox vb-box | |
echo 'machine created' | |
fi | |
if ! docker-machine status vb-box | grep -q 'Running'; then | |
echo 'starting vb-box' | |
docker-machine start vb-box | |
echo 'vb-box started' | |
fi | |
eval $(docker-machine env vb-box) | |
if [ $1 = "halt" ]; then | |
echo "halting" | |
docker-machine stop vb-box | |
else | |
docker $@ | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment