Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created June 29, 2018 11:15
Show Gist options
  • Save Voronenko/5fb749b3c32052f8cbfe4be0a803c6a6 to your computer and use it in GitHub Desktop.
Save Voronenko/5fb749b3c32052f8cbfe4be0a803c6a6 to your computer and use it in GitHub Desktop.
Temporary fallback host.docker.internal in custom containers #docker
HOST_DOMAIN="host.docker.internal"
ping -q -c1 $HOST_DOMAIN > /dev/null 2>&1
if [ $? -ne 0 ]; then
HOST_IP=$(ip route | awk 'NR==1 {print $3}')
echo -e "$HOST_IP\t$HOST_DOMAIN" >> /etc/hosts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment