Last active
January 1, 2017 17:05
-
-
Save blackandred/e72c8fdf7cf239896835387e969d096e to your computer and use it in GitHub Desktop.
Docker: Get host IP and add it locally as docker_host_machine so it could be accessible eg. via http://docker_host_machine
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
#!/bin/bash | |
# | |
# Get host IP and add it locally as docker_host_machine so it could be accessible eg. via http://docker_host_machine | |
# ================================ | |
# Requirements: iproute2 | |
# | |
cat /etc/hosts | grep -v "docker_host_machine" > /etc/hosts.2 && mv /etc/hosts.2 /etc/hosts | |
echo "$(ip route show|grep src|awk '{print $9}') docker_host_machine" >> /etc/hosts | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment