Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andrewvmail/dcb090b3ceace8e4c2fe0046a06c574f to your computer and use it in GitHub Desktop.
Save andrewvmail/dcb090b3ceace8e4c2fe0046a06c574f to your computer and use it in GitHub Desktop.

Revisions

  1. @0x414a 0x414a revised this gist Feb 29, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,8 @@ setup_docker_machine() {
    ## Prerequisites
    echo 'Installing xhyve, docker, docker-compose, and go'
    brew update
    brew install xhyve docker docker-compose go
    brew install xhyve docker go
    brew install docker-compose --without-docker-machine --without-docker

    ## Set up Go
    echo 'Setting up go directories'
  2. @0x414a 0x414a revised this gist Feb 29, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -30,13 +30,13 @@ $ sudo rm -rf ~/.docker
    To install:

    ```sh
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/install.sh)"
    $ sh -c "$(curl -fsSL https://gist.github.com/0x414A/0d5303b787a449cd564f/raw/install.sh)"
    ```

    To uninstall:

    ```sh
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh)"
    $ sh -c "$(curl -fsSL https://gist.github.com/0x414A/0d5303b787a449cd564f/raw/uninstall.sh)"
    ```

    ## Known Issues / shenanigans to be aware of
  3. @0x414a 0x414a revised this gist Feb 29, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    GIST_URL='https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw'
    GIST_URL='https://gist.github.com/0x414A/0d5303b787a449cd564f/raw'

    setup_shell() {
    [ -f ~/.profile ] && \
  4. @astrohckr astrohckr revised this gist Jan 16, 2016. 2 changed files with 11 additions and 17 deletions.
    4 changes: 1 addition & 3 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ In this script, I've also set up a way to autoconfigure terminal sessions to loa
    ## Requirements

    - At least OS X 10.10 (Yosemite) because Hypervisor.framework, on which xhyve depends, was first introduced in Yosemite.
    - [homebrew](http://brew.sh)
    - [homebrew](http://brew.sh)

    ## Before you begin

    @@ -43,7 +43,5 @@ $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a44

    - After rebooting, when you open a Terminal / iTerm session, there will be an error regarding TLS certs. You will need to run `docker-machine restart dev`.

    ## Credits

    Based on [this](http://cavaliercoder.com/blog/update-etc-hosts-for-docker-machine.html)

    24 changes: 10 additions & 14 deletions profile
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,10 @@
    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
    if [[ $(pgrep docker-machine-driver-xhyve) ]]; then
    if [[ $(docker-machine status dev) == *"Running"* ]]; then
    eval $(docker-machine env dev)
    else
    echo "It looks like docker-machine did not start correctly :("
    fi
    else
    echo "docker-machine dev is not running"
    echo "try running: docker-machine start dev"
    fi
  5. @astrohckr astrohckr revised this gist Jan 14, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ So one of the painful points of using `docker` on OS X is that you need to run a

    No more dealing with virtualbox shenanigans!

    In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on `docker-machine`) so you do not have to run `eval $(docker-machine env whatever)` every time you open a new terminal window.

    ## Requirements

    - At least OS X 10.10 (Yosemite) because Hypervisor.framework, on which xhyve depends, was first introduced in Yosemite.
  6. @astrohckr astrohckr revised this gist Jan 14, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,10 @@ To uninstall:
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh)"
    ```

    ## Known Issues / shenanigans to be aware of

    - After rebooting, when you open a Terminal / iTerm session, there will be an error regarding TLS certs. You will need to run `docker-machine restart dev`.

    ## Credits

    Based on [this](http://cavaliercoder.com/blog/update-etc-hosts-for-docker-machine.html)
  7. @astrohckr astrohckr revised this gist Jan 14, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@ No more dealing with virtualbox shenanigans!

    ## Requirements

    - At least OS X 10.10 (Yosemite) because Hypervisor.framework, on which xhyve depends, was first introduced in Yosemite.
    - [homebrew](http://brew.sh)

    ## Before you begin
  8. @astrohckr astrohckr revised this gist Jan 13, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,6 @@ setup_docker_machine() {
    shellrc=$HOME/.bash_profile
    fi
    echo 'export GOPATH=$HOME/.go' >> $shellrc
    source $shellrc
    export GOPATH=$HOME/.go

    ## Install docker-machine
  9. @astrohckr astrohckr revised this gist Jan 13, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ setup_docker_machine() {
    echo "Setup docker-machine to launch on startup"
    }

    setup_shell
    setup_docker_machine
    setup_shell

    echo "Now, reboot."
  10. @astrohckr astrohckr revised this gist Jan 13, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ setup_shell() {
    setup_docker_machine() {
    ## Prerequisites
    echo 'Installing xhyve, docker, docker-compose, and go'
    brew update
    brew install xhyve docker docker-compose go

    ## Set up Go
    @@ -27,10 +28,11 @@ setup_docker_machine() {
    if [[ $SHELL == *"zsh"* ]]; then
    shellrc=$HOME/.zshrc
    else
    shellrc=$HOME/.bashrc
    shellrc=$HOME/.bash_profile
    fi
    echo 'export GOPATH=$HOME/.go' >> $shellrc
    source $shellrc
    export GOPATH=$HOME/.go

    ## Install docker-machine
    go get github.com/docker/machine
  11. @astrohckr astrohckr revised this gist Jan 13, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    So one of the painful points of using `docker` on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With [xhyve](https://github.com/mist64/xhyve), a OS X virtualization system, and [docker-machine-xhyve](https://github.com/zchee/docker-machine-driver-xhyve) you can now have `docker` use the native OS X hypervisor to run containers.

    No more dealing with virtualbox shenanigans!

    ## Requirements

    - [homebrew](http://brew.sh)
  12. @astrohckr astrohckr revised this gist Jan 13, 2016. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,24 @@
    ## What this?

    So one of the painful points of using `docker` on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With [xhyve](https://github.com/mist64/xhyve), a OS X virtualization system, and [docker-machine-xhyve](https://github.com/zchee/docker-machine-driver-xhyve) you can now have `docker` use the native OS X hypervisor to run containers.

    ## Requirements

    - homebrew
    - [homebrew](http://brew.sh)

    ## Before you begin

    - Uninstall Docker Toolbox
    - `sudo rm -rf ~/.docker`
    Uninstall Docker Toolbox:

    ```sh
    $ sh -c "$(curl -fsSl https://raw.githubusercontent.com/docker/toolbox/master/osx/uninstall.sh)"
    ```

    And remove existing caches

    ```sh
    $ sudo rm -rf ~/.docker
    ```

    ## Usage

  13. @astrohckr astrohckr revised this gist Jan 13, 2016. 1 changed file with 0 additions and 34 deletions.
    34 changes: 0 additions & 34 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -1,34 +0,0 @@
    ## 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
  14. @astrohckr astrohckr revised this gist Jan 13, 2016. 2 changed files with 44 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,12 @@
    ## Requirements

    - homebrew

    ## Before you begin

    - Uninstall Docker Toolbox
    - `sudo rm -rf ~/.docker`

    ## Usage

    To install:
    35 changes: 35 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,41 @@ setup_shell() {
    }

    setup_docker_machine() {
    ## 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

    mkdir -p ~/Library/LaunchAgents

    curl $GIST_URL/com.docker.machine.dev.plist -o\
  15. @astrohckr astrohckr revised this gist Jan 13, 2016. 6 changed files with 40 additions and 12 deletions.
    6 changes: 0 additions & 6 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,3 @@
    ## Requirements

    * Docker Machine + Docker. Install [Docker Toolbox](https://www.docker.com/docker-toolbox)
    * curl
    * A Virtualbox-driven Docker Machine called "default" ```docker-machine create --driver virtualbox default``` (this is the default with Docker toolkit).

    ## Usage

    To install:
    34 changes: 34 additions & 0 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    ## 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
    Original file line number Diff line number Diff line change
    @@ -8,12 +8,12 @@
    <string>{{user-path}}</string>
    </dict>
    <key>Label</key>
    <string>com.docker.machine.default</string>
    <string>com.docker.machine.dev</string>
    <key>ProgramArguments</key>
    <array>
    <string>{{docker-machine}}</string>
    <string>start</string>
    <string>default</string>
    <string>dev</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    4 changes: 2 additions & 2 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -17,8 +17,8 @@ setup_shell() {
    setup_docker_machine() {
    mkdir -p ~/Library/LaunchAgents

    curl $GIST_URL/com.docker.machine.default.plist -o\
    ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    curl $GIST_URL/com.docker.machine.dev.plist -o\
    ~/Library/LaunchAgents/com.docker.machine.dev.plist && \
    echo "Setup docker-machine to launch on startup"
    }

    2 changes: 1 addition & 1 deletion profile
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    eval "$(docker-machine env default)"
    eval "$(docker-machine env dev)"

    update-docker-host(){
    # clear existing docker.local entry from /etc/hosts
    2 changes: 1 addition & 1 deletion uninstall.sh
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ remove_shell_setup() {
    }

    remove_docker_machine_setup() {
    rm ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    rm ~/Library/LaunchAgents/com.docker.machine.dev.plist && \
    echo "Removed docker-machine from startup"
    }

  16. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion install.sh
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,7 @@ setup_docker_machine() {
    echo "Setup docker-machine to launch on startup"
    }

    echo $GIST_URL
    setup_shell
    setup_docker_machine

    echo "Now, reboot."
  17. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -5,23 +5,23 @@ setup_shell() {
    mv ~/.profile{,.backup} && \
    echo "Created backup of existing ~/.profile to ~/.profile.backup"

    curl -o $GIST_URL/profile ~/.profile && echo "Setup $SHELL"
    curl $GIST_URL/profile -o ~/.profile && echo "Setup $SHELL"

    if [[ $SHELL == *"zsh"* ]];
    then
    [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup}
    curl -o $GIST_URL/zprofile ~/.zprofile
    curl $GIST_URL/zprofile -o ~/.zprofile
    fi
    }

    setup_docker_machine() {
    mkdir -p ~/Library/LaunchAgents

    curl -o $GIST_URL/com.docker.machine.default.plist ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    curl $GIST_URL/com.docker.machine.default.plist -o\
    ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    echo "Setup docker-machine to launch on startup"
    }

    setup_shell
    setup_docker_machine
    echo $GIST_URL

    echo "Now, reboot."
  18. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 00_OSX_Docker_Machine_Setup.md
    Original file line number Diff line number Diff line change
    @@ -9,13 +9,13 @@
    To install:

    ```sh
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/install.sh')"
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/install.sh)"
    ```

    To uninstall:

    ```sh
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh')"
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh)"
    ```

    ## Credits
  19. @bitjockey42 bitjockey42 renamed this gist Dec 12, 2015. 1 changed file with 0 additions and 0 deletions.
  20. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 4 changed files with 2 additions and 65 deletions.
    4 changes: 2 additions & 2 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -5,12 +5,12 @@ setup_shell() {
    mv ~/.profile{,.backup} && \
    echo "Created backup of existing ~/.profile to ~/.profile.backup"

    curl -o $GIST_URL/.profile ~/.profile && echo "Setup $SHELL"
    curl -o $GIST_URL/profile ~/.profile && echo "Setup $SHELL"

    if [[ $SHELL == *"zsh"* ]];
    then
    [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup}
    curl -o $GIST_URL/.zprofile ~/.zprofile
    curl -o $GIST_URL/zprofile ~/.zprofile
    fi
    }

    File renamed without changes.
    63 changes: 0 additions & 63 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,63 +0,0 @@
    #!/usr/bin/env sh

    setup_shell() {
    [ -f ~/.profile ] && \
    mv ~/.profile{,.backup} && \
    echo "Created backup of existing ~/.profile to ~/.profile.backup"

    cp ./.profile ~/.profile && echo "Setup $SHELL"

    if [[ $SHELL == *"zsh"* ]];
    then
    [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup}
    cp ./.zprofile ~/.zprofile
    fi
    }

    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
    }

    setup_docker_machine() {
    mkdir -p ~/Library/LaunchAgents
    cp ./com.docker.machine.default.plist ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    echo "Setup docker-machine to launch on startup"
    }

    remove_docker_machine_setup() {
    rm ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    echo "Removed docker-machine from startup"
    }

    install() {
    setup_shell
    setup_docker_machine
    echo "Now reboot."
    }

    uninstall() {
    remove_shell_setup
    remove_docker_machine_setup
    }

    case "$1" in
    install)
    install
    ;;
    uninstall)
    uninstall
    ;;
    *)
    echo $"Usage: $0 {install|uninstall}"
    exit 1
    esac

    File renamed without changes.
  21. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 3 changed files with 59 additions and 7 deletions.
    17 changes: 10 additions & 7 deletions Start up local Docker Machine on OSX automatically.md
    Original file line number Diff line number Diff line change
    @@ -6,16 +6,19 @@

    ## Usage

    The git.io URL (http://git.io/vsk46) is a shortened form of the raw url of the plist.
    To install:

    ```sh
    $ curl -sL http://git.io/vsk46 | \
    sed -e "s?{{docker-machine}}?$(which docker-machine)?" \
    -e "s?{{user-path}}?$(echo $PATH)?" \
    >~/Library/LaunchAgents/com.docker.machine.default.plist && \
    launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/install.sh')"
    ```
    To uninstall:
    ```sh
    $ sh -c "$(curl -fsSL https://gist.github.com/astrohckr/0d5303b787a449cd564f/raw/uninstall.sh')"
    ```

    ## Credits

    Based on [this](http://cavaliercoder.com/blog/update-etc-hosts-for-docker-machine.html)
    Based on [this](http://cavaliercoder.com/blog/update-etc-hosts-for-docker-machine.html)

    27 changes: 27 additions & 0 deletions install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    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 -o $GIST_URL/.profile ~/.profile && echo "Setup $SHELL"

    if [[ $SHELL == *"zsh"* ]];
    then
    [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup}
    curl -o $GIST_URL/.zprofile ~/.zprofile
    fi
    }

    setup_docker_machine() {
    mkdir -p ~/Library/LaunchAgents

    curl -o $GIST_URL/com.docker.machine.default.plist ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    echo "Setup docker-machine to launch on startup"
    }

    setup_shell
    setup_docker_machine

    echo "Now, reboot."
    22 changes: 22 additions & 0 deletions uninstall.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    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.default.plist && \
    echo "Removed docker-machine from startup"
    }

    remove_shell_setup
    remove_docker_machine_setup
    echo "Removed all the things."

  22. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 1 changed file with 27 additions and 13 deletions.
    40 changes: 27 additions & 13 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,11 @@
    #!/usr/bin/env sh

    setup_shell() {
    [ -f ~/.profile ] && mv ~/.profile{,.backup}
    [ -f ~/.profile ] && \
    mv ~/.profile{,.backup} && \
    echo "Created backup of existing ~/.profile to ~/.profile.backup"

    cp ./.profile ~/.profile
    cp ./.profile ~/.profile && echo "Setup $SHELL"

    if [[ $SHELL == *"zsh"* ]];
    then
    @@ -12,27 +14,39 @@ setup_shell() {
    fi
    }

    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
    }

    setup_docker_machine() {
    mkdir -p ~/Library/LaunchAgents
    cp ./com.docker.machine.default.plist ~/Library/LaunchAgents/com.docker.machine.default.plist
    cp ./com.docker.machine.default.plist ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    echo "Setup docker-machine to launch on startup"
    }

    remove_docker_machine_setup() {
    rm ~/Library/LaunchAgents/com.docker.machine.default.plist && \
    echo "Removed docker-machine from startup"
    }

    install() {
    setup_shell
    setup_docker_machine
    echo "Now reboot."
    }

    uninstall() {
    rm ~/.profile
    [ -f ~/.profile.backup ] && mv ~/.profile{.backup,}

    if [[ $SHELL == *"zsh"* ]]
    then
    rm ~/.zprofile
    [ -f ~/.zprofile.backup ] && mv ~/.zprofile{.backup,}
    fi

    rm ~/Library/LaunchAgents/com.docker.machine.default.plist
    remove_shell_setup
    remove_docker_machine_setup
    }

    case "$1" in
  23. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    #!/usr/bin/env sh

    setup_shell() {
    mv ~/.profile{,.backup}
    [ -f ~/.profile ] && mv ~/.profile{,.backup}

    cp ./.profile ~/.profile

    if [[ $SHELL == *"zsh"* ]]
    if [[ $SHELL == *"zsh"* ]];
    then
    mv ~/.zprofile{,.backup}
    [ -f ~/.zprofile ] && mv ~/.zprofile{,.backup}
    cp ./.zprofile ~/.zprofile
    fi
    }
    @@ -23,12 +24,12 @@ install() {

    uninstall() {
    rm ~/.profile
    mv ~/.profile{.backup,}
    [ -f ~/.profile.backup ] && mv ~/.profile{.backup,}

    if [[ $SHELL == *"zsh"* ]]
    then
    rm ~/.zprofile
    mv ~/.zprofile{.backup,}
    [ -f ~/.zprofile.backup ] && mv ~/.zprofile{.backup,}
    fi

    rm ~/Library/LaunchAgents/com.docker.machine.default.plist
  24. @bitjockey42 bitjockey42 revised this gist Dec 12, 2015. 1 changed file with 48 additions and 0 deletions.
    48 changes: 48 additions & 0 deletions setup.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    #!/usr/bin/env sh

    setup_shell() {
    mv ~/.profile{,.backup}
    cp ./.profile ~/.profile

    if [[ $SHELL == *"zsh"* ]]
    then
    mv ~/.zprofile{,.backup}
    cp ./.zprofile ~/.zprofile
    fi
    }

    setup_docker_machine() {
    mkdir -p ~/Library/LaunchAgents
    cp ./com.docker.machine.default.plist ~/Library/LaunchAgents/com.docker.machine.default.plist
    }

    install() {
    setup_shell
    setup_docker_machine
    }

    uninstall() {
    rm ~/.profile
    mv ~/.profile{.backup,}

    if [[ $SHELL == *"zsh"* ]]
    then
    rm ~/.zprofile
    mv ~/.zprofile{.backup,}
    fi

    rm ~/Library/LaunchAgents/com.docker.machine.default.plist
    }

    case "$1" in
    install)
    install
    ;;
    uninstall)
    uninstall
    ;;
    *)
    echo $"Usage: $0 {install|uninstall}"
    exit 1
    esac

  25. @astrohckr astrohckr revised this gist Dec 12, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions .zprofile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    emulate sh -c '. ~/.profile'
  26. @astrohckr astrohckr revised this gist Dec 12, 2015. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions .profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    eval "$(docker-machine env default)"

    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
  27. @astrohckr astrohckr revised this gist Dec 12, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Start up local Docker Machine on OSX automatically.md
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,8 @@ $ curl -sL http://git.io/vsk46 | \
    -e "s?{{user-path}}?$(echo $PATH)?" \
    >~/Library/LaunchAgents/com.docker.machine.default.plist && \
    launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist
    ```
    ```

    ## Credits

    Based on [this](http://cavaliercoder.com/blog/update-etc-hosts-for-docker-machine.html)
  28. @astrohckr astrohckr revised this gist Dec 12, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Start up local Docker Machine on OSX automatically.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Requirements

    * Docker Machine + Docker
    * Docker Machine + Docker. Install [Docker Toolbox](https://www.docker.com/docker-toolbox)
    * curl
    * A Virtualbox-driven Docker Machine called "default" ```docker-machine create --driver virtualbox default``` (this is the default with Docker toolkit).

  29. @andystanton andystanton revised this gist Aug 18, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Start up local Docker Machine on OSX automatically.md
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,14 @@

    * Docker Machine + Docker
    * curl
    * A Virtualbox-driven Docker Machine called "default" ```docker-machine create --driver virtualbox default```
    * A Virtualbox-driven Docker Machine called "default" ```docker-machine create --driver virtualbox default``` (this is the default with Docker toolkit).

    ## Usage

    The git.io URL (http://git.io/vYM15) is a shortened form of the raw url of the plist.
    The git.io URL (http://git.io/vsk46) is a shortened form of the raw url of the plist.

    ```sh
    $ curl -sL http://git.io/vYM15 | \
    $ curl -sL http://git.io/vsk46 | \
    sed -e "s?{{docker-machine}}?$(which docker-machine)?" \
    -e "s?{{user-path}}?$(echo $PATH)?" \
    >~/Library/LaunchAgents/com.docker.machine.default.plist && \
  30. @andystanton andystanton revised this gist Aug 18, 2015. 2 changed files with 5 additions and 5 deletions.
    6 changes: 3 additions & 3 deletions Start up local Docker Machine on OSX automatically.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    * Docker Machine + Docker
    * curl
    * A Virtualbox-driven Docker Machine called "dev" ```docker-machine create --driver virtualbox dev```
    * A Virtualbox-driven Docker Machine called "default" ```docker-machine create --driver virtualbox default```

    ## Usage

    @@ -12,6 +12,6 @@ The git.io URL (http://git.io/vYM15) is a shortened form of the raw url of the p
    $ curl -sL http://git.io/vYM15 | \
    sed -e "s?{{docker-machine}}?$(which docker-machine)?" \
    -e "s?{{user-path}}?$(echo $PATH)?" \
    >~/Library/LaunchAgents/com.docker.machine.dev.plist && \
    launchctl load ~/Library/LaunchAgents/com.docker.machine.dev.plist
    >~/Library/LaunchAgents/com.docker.machine.default.plist && \
    launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist
    ```
    Original file line number Diff line number Diff line change
    @@ -8,12 +8,12 @@
    <string>{{user-path}}</string>
    </dict>
    <key>Label</key>
    <string>com.docker.machine.dev</string>
    <string>com.docker.machine.default</string>
    <key>ProgramArguments</key>
    <array>
    <string>{{docker-machine}}</string>
    <string>start</string>
    <string>dev</string>
    <string>default</string>
    </array>
    <key>RunAtLoad</key>
    <true/>