Created
June 2, 2016 21:07
-
-
Save slavahatnuke/8f5c6908cf024a7271ff203d6a07f873 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 | |
update-docker-host(){ | |
# clear existing docker.local entry from /etc/hosts | |
sudo sed -i '' '/[[:space:]]docker\.local$/d' /etc/hosts | |
# get ip of running machine | |
export DOCKER_IP="$(echo ${DOCKER_HOST} | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" | |
# update /etc/hosts with docker machine ip | |
[[ -n $DOCKER_IP ]] && sudo /bin/bash -c "echo \"${DOCKER_IP} docker.local\" >> /etc/hosts" | |
} | |
update-docker-host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment