Skip to content

Instantly share code, notes, and snippets.

@zobzn
Last active December 26, 2016 21:05
Show Gist options
  • Save zobzn/2869741a57cd5d4124685018a9348212 to your computer and use it in GitHub Desktop.
Save zobzn/2869741a57cd5d4124685018a9348212 to your computer and use it in GitHub Desktop.
dockerhost
#!/bin/bash
if [[ -z $(grep dockerhost /etc/hosts) ]]
then
echo $(printf "%d." $(echo $(awk '$2 == "00000000" {print $3}' /proc/net/route) | sed 's/../0x& /g' | tr ' ' '\n' | tac) | sed 's/\.$/\n/') dockerhost >> /etc/hosts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment