Skip to content

Instantly share code, notes, and snippets.

@x-cray
Created November 23, 2015 12:36
Show Gist options
  • Save x-cray/a37992ce9faf5eeaae88 to your computer and use it in GitHub Desktop.
Save x-cray/a37992ce9faf5eeaae88 to your computer and use it in GitHub Desktop.
Docker entrypoint script for adding host address to /etc/hosts
#!/bin/sh
set -e
DOCKERHOST=$(ip route show 0.0.0.0/0 | grep -Eo 'via \S+' | awk '{ print $2 }')
echo "$DOCKERHOST dockerhost" >> /etc/hosts
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment