Forked from fntlnz/establish-routing-to-docker-osx-container-network
Last active
March 29, 2019 18:30
-
-
Save metacollin/c65638a68a75a62b884b8d7e664b1d15 to your computer and use it in GitHub Desktop.
Revisions
-
metacollin revised this gist
Mar 29, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,10 @@ # software defined network where containers created via boot2docker # reside. This lets you casually directly to ports (ssh, http, etc. etc.) # on those containers. # function ohfk(){ echo "FUCK: $*" ; } function ohno(){ echo "FAILING: $*" ; exit 1; } [ ! -z "$1" ] && DOCKER_MACHINE_ID="$1" || DOCKER_MACHINE_ID="default" DOCKER_MACHINE_ID=$1 IP_OF_DOCKER_HOST=$(docker-machine ip $DOCKER_MACHINE_ID) -
metacollin revised this gist
Mar 29, 2019 . 2 changed files with 20 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,19 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/bin/bash # Script to instruct the Mac how to route packets to the # software defined network where containers created via boot2docker # reside. This lets you casually directly to ports (ssh, http, etc. etc.) # on those containers. function ohfk(){ echo "FUCK: $*" ; } function ohno(){ echo "FAILING: $*" ; exit 1; } DOCKER_MACHINE_ID=$1 IP_OF_DOCKER_HOST=$(docker-machine ip $DOCKER_MACHINE_ID) DOCKER_ROUTE_TO_SADNESS=$(docker-machine ssh $DOCKER_MACHINE_ID 'ip route show' 2> /dev/null | awk '/docker0/{print $1}' ) echo "Establishing route to $DOCKER_ROUTE_TO_SADNESS via $IP_OF_DOCKER_HOST" if netstat -rn | awk "\$2 == \"$IP_OF_DOCKER_HOST\" {exit(1);}" ; then sudo route -n add "$DOCKER_ROUTE_TO_SADNESS" "$IP_OF_DOCKER_HOST" else ohfk "Already routing something to the docker VM ..." netstat -rn \ | awk '$2 == "192.168.59.103"||/Destination.*Refs/{print;}' ohno "You stupid bitch." fi -
fntlnz renamed this gist
Jul 29, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
fntlnz revised this gist
Jul 29, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ function ERROR(){ echo "ERROR: $*" ; } function FAIL(){ echo "FAILING: $*" ; exit 1; } IP_OF_DOCKER_HOST="172.16.42.43" SDN_NET_FOR_CONTAINERS=$(docker-osx ssh -c 'ip route show' 2> /dev/null | awk '/docker0/{print $1}' ) echo "Establishing route to $SDN_NET_FOR_CONTAINERS via $IP_OF_DOCKER_HOST" if netstat -rn | awk "\$2 == \"$IP_OF_DOCKER_HOST\" {exit(1);}" ; then sudo route -n add "$SDN_NET_FOR_CONTAINERS" "$IP_OF_DOCKER_HOST" -
fntlnz revised this gist
Jul 29, 2014 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,8 @@ # on those containers. function ERROR(){ echo "ERROR: $*" ; } function FAIL(){ echo "FAILING: $*" ; exit 1; } IP_OF_DOCKER_HOST="172.16.42.43" SDN_NET_FOR_CONTAINERS=$(boot2docker ssh ip route show 2> /dev/null | awk '/docker0/{print $1}' ) echo "Establishing route to $SDN_NET_FOR_CONTAINERS via $IP_OF_DOCKER_HOST" if netstat -rn | awk "\$2 == \"$IP_OF_DOCKER_HOST\" {exit(1);}" ; then -
bhyde revised this gist
Jul 7, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,8 @@ #!/bin/bash # Script to instruct the Mac how to route packets to the # software defined network where containers created via boot2docker # reside. This lets you casually directly to ports (ssh, http, etc. etc.) # on those containers. function ERROR(){ echo "ERROR: $*" ; } function FAIL(){ echo "FAILING: $*" ; exit 1; } if [[ 'running' != $(boot2docker status) ]] -
bhyde created this gist
Jul 7, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/bin/bash # Script to instruct the Mac how to route packets to the # software defined network where containers created via boot2docker # reside. This lets you casually directly to ports on those containers. function ERROR(){ echo "ERROR: $*" ; } function FAIL(){ echo "FAILING: $*" ; exit 1; } if [[ 'running' != $(boot2docker status) ]] then FAIL "boot2docker's VM not running" ; fi IP_OF_DOCKER_HOST=$(boot2docker ip 2> /dev/null) SDN_NET_FOR_CONTAINERS=$(boot2docker ssh ip route show 2> /dev/null | awk '/docker0/{print $1}' ) echo "Establishing route to $SDN_NET_FOR_CONTAINERS via $IP_OF_DOCKER_HOST" if netstat -rn | awk "\$2 == \"$IP_OF_DOCKER_HOST\" {exit(1);}" ; then sudo route -n add "$SDN_NET_FOR_CONTAINERS" "$IP_OF_DOCKER_HOST" else ERROR "Already routing something to the docker VM ..." netstat -rn \ | awk '$2 == "192.168.59.103"||/Destination.*Refs/{print;}' FAIL "... so never mind." fi