Created
March 3, 2016 00:36
-
-
Save deizel/89fa6a08f7208600b79f to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/usr/bin/env bash | |
set -e | |
sudo route -n delete 172.17.0.0/16 | |
sudo route -n add 172.17.0.0/16 local.docker | |
DOCKER_INTERFACE=$(route get local.docker | grep interface: | cut -f 2 -d: | tr -d ' ') | |
DOCKER_INTERFACE_MEMBERSHIP=$(ifconfig "${DOCKER_INTERFACE}" | grep member: | cut -f 2 -d: | cut -c 2-4) | |
if [ -z "$DOCKER_INTERFACE_MEMBERSHIP" ]; then | |
echo -e "Could not find 'member:' in \`ifconfig ${DOCKER_INTERFACE}\` output.\n" | |
echo -e "Try restarting \`dlite\`:\n" | |
echo -e " dlite stop && dlite start\n" | |
exit 1 | |
fi | |
sudo ifconfig "${DOCKER_INTERFACE}" -hostfilter "${DOCKER_INTERFACE_MEMBERSHIP}" | |
DOCKER_CONTAINER_IP=$(docker inspect -f '{{.NetworkSettings.IPAddress}}' "$(docker ps -q | head -1)") | |
ping -c 1 "${DOCKER_CONTAINER_IP}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment