Skip to content

Instantly share code, notes, and snippets.

@Cloudo
Created May 31, 2016 06:24
Show Gist options
  • Select an option

  • Save Cloudo/6f042aea7dde7c9d9d95ce374cf764c6 to your computer and use it in GitHub Desktop.

Select an option

Save Cloudo/6f042aea7dde7c9d9d95ce374cf764c6 to your computer and use it in GitHub Desktop.
#Script to set custom iprange for dockers bridge, also starts docker
cat << EOF >> /etc/rc.local
#docker
subnet="10.0.41.1/16"
if ! [[ "$(ip link show docker0)" ]]; then
ip link add docker0 type bridge
ip addr add "$subnet" dev docker0
ip link set docker0 up
iptables -t nat -A POSTROUTING -s "$subnet" ! -d "$subnet" -j MASQUERADE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment