Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Created April 4, 2015 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacoelho/27df0d14e221625f5455 to your computer and use it in GitHub Desktop.
Save jacoelho/27df0d14e221625f5455 to your computer and use it in GitHub Desktop.
boot2docker route
#!/bin/bash
if [[ 'running' != $(boot2docker status) ]]; then
echo "boot2docker not running"
exit 1
fi
BOOT2DOCKER_IP=$(boot2docker ip)
BOOT2DOCKER_NETWORK=$(boot2docker ssh "ip route show" | awk '/docker0/{print $1}')
sudo bash <<EOF
route -n delete "${BOOT2DOCKER_NETWORK}" "${BOOT2DOCKER_IP}" || true
route -n add "${BOOT2DOCKER_NETWORK}" "${BOOT2DOCKER_IP}"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment