Skip to content

Instantly share code, notes, and snippets.

@moofish32
Created June 30, 2015 22:34
Show Gist options
  • Save moofish32/7a4a21774f93e8454128 to your computer and use it in GitHub Desktop.
Save moofish32/7a4a21774f93e8454128 to your computer and use it in GitHub Desktop.
Boot2Docker Fix My DNS!
DOCKER_BRIDGE=`boot2docker ssh ifconfig docker0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
echo "Setting docker dns to the docker bridge @ $DOCKER_BRIDGE"
boot2docker ssh sudo "ash -c \"echo EXTRA_ARGS=\'--dns $DOCKER_BRIDGE --dns $(scutil --dns | awk -F ': ' '/nameserver/{print $2}' | head -1) --dns-search service.consul\' > /var/lib/boot2docker/profile\""
boot2docker restart
echo "... b2d restarted."
@meeeu
Copy link

meeeu commented Jul 6, 2015

so....run after boot2docker starts?

@moofish32
Copy link
Author

Ideally yes after it's started you can see it will restart it of course. I typically run this anytime I switch VPN's

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