Skip to content

Instantly share code, notes, and snippets.

@nickgartmann
Last active August 29, 2015 14:08
Show Gist options
  • Save nickgartmann/caa941df1e3c99386cbb to your computer and use it in GitHub Desktop.
Save nickgartmann/caa941df1e3c99386cbb to your computer and use it in GitHub Desktop.
Put localdocker into your hosts file on OS X
#! /bin/bash
# Get the ip from boot2docker
boot2docker_ip=$(sudo -u $SUDO_USER boot2docker ip 2>&1 | awk '{ print $NF }' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g')
hosts=`cat /etc/hosts | sed "s/^.*localdocker.*$//g"`
echo "$hosts" > /etc/hosts
echo "$boot2docker_ip localdocker" >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment