To install:
$ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/install.sh)"To uninstall:
$ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh)"Based on this
To install:
$ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/install.sh)"To uninstall:
$ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh)"Based on this
| ## Prerequisites | |
| echo 'Installing xhyve, docker, docker-compose, and go' | |
| brew install xhyve docker docker-compose go | |
| ## Set up Go | |
| echo 'Setting up go directories' | |
| mkdir ~/.go | |
| ## Set up shell | |
| if [[ $SHELL == *"zsh"* ]]; then | |
| shellrc=$HOME/.zshrc | |
| else | |
| shellrc=$HOME/.bashrc | |
| fi | |
| echo 'export GOPATH=$HOME/.go' >> $shellrc | |
| source $shellrc | |
| ## Install docker-machine | |
| go get github.com/docker/machine | |
| cd $GOPATH/src/github.com/docker/machine | |
| make build | |
| make install | |
| ## Install docker-machine xhyve | |
| export GO15VENDOREXPERIMENT=1 | |
| go get -u github.com/zchee/docker-machine-driver-xhyve | |
| cd $GOPATH/src/github.com/zchee/docker-machine-driver-xhyve | |
| make build | |
| make install | |
| sudo chown root:wheel $GOPATH/bin/docker-machine-driver-xhyve | |
| sudo chmod u+s $GOPATH/bin/docker-machine-driver-xhyve | |
| ## Create the xhyve machine | |
| docker-machine create dev --driver xhyve --xhyve-experimental-nfs-share |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>EnvironmentVariables</key> | |
| <dict> | |
| <key>PATH</key> | |
| <string>{{user-path}}</string> | |
| </dict> | |
| <key>Label</key> | |
| <string>com.docker.machine.dev</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>{{docker-machine}}</string> | |
| <string>start</string> | |
| <string>dev</string> | |
| </array> | |
| <key>RunAtLoad</key> | |
| <true/> | |
| </dict> | |
| </plist> |
| GIST_URL='https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw' | |
| setup_shell() { | |
| [ -f ~/.profile ] && \ | |
| mv ~/.profile{,.backup} && \ | |
| echo "Created backup of existing ~/.profile to ~/.profile.backup" | |
| curl $GIST_URL/profile -o ~/.profile && echo "Setup $SHELL" | |
| if [[ $SHELL == *"zsh"* ]]; | |
| then | |
| [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup} | |
| curl $GIST_URL/zprofile -o ~/.zprofile | |
| fi | |
| } | |
| setup_docker_machine() { | |
| mkdir -p ~/Library/LaunchAgents | |
| curl $GIST_URL/com.docker.machine.dev.plist -o\ | |
| ~/Library/LaunchAgents/com.docker.machine.dev.plist && \ | |
| echo "Setup docker-machine to launch on startup" | |
| } | |
| setup_shell | |
| setup_docker_machine | |
| echo "Now, reboot." |
| eval "$(docker-machine env dev)" | |
| update-docker-host(){ | |
| # clear existing docker.local entry from /etc/hosts | |
| sudo sed -i '' '/[[:space:]]docker\.local$/d' /etc/hosts | |
| # get ip of running machine | |
| export DOCKER_IP="$(echo ${DOCKER_HOST} | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" | |
| # update /etc/hosts with docker machine ip | |
| [[ -n $DOCKER_IP ]] && sudo /bin/bash -c "echo \"${DOCKER_IP} docker.local\" >> /etc/hosts" | |
| } | |
| update-docker-host |
| remove_shell_setup() { | |
| rm ~/.profile | |
| [ -f ~/.profile.backup ] && \ | |
| mv ~/.profile{.backup,} && \ | |
| echo "Restored ~/.profile.backup to ~/.profile" | |
| if [[ $SHELL == *"zsh"* ]] | |
| then | |
| rm ~/.zprofile | |
| [ -f ~/.zprofile.backup ] && mv ~/.zprofile{.backup,} | |
| fi | |
| } | |
| remove_docker_machine_setup() { | |
| rm ~/Library/LaunchAgents/com.docker.machine.dev.plist && \ | |
| echo "Removed docker-machine from startup" | |
| } | |
| remove_shell_setup | |
| remove_docker_machine_setup | |
| echo "Removed all the things." | |
| emulate sh -c '. ~/.profile' |