Created
July 22, 2014 00:47
-
-
Save jeffbrl/363d06afb0524aa6ab8c to your computer and use it in GitHub Desktop.
Bring up IPv6-enabled docker container
This file contains hidden or 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 | |
# | |
# Jeff Loughridge | |
# July 2014 | |
# jeffl at brooksconsulting-llc.com | |
# first argument to script must be IPv6 address from DO-allocated | |
# space that is not part of the first /126 (e.g. 0x4 to 0xF as last | |
# hex character | |
IPV6_ADDRESS=$1 | |
if [ -z "$IPV6_ADDRESS" ]; then | |
echo "please specify IPv6 address for container's eth0" | |
exit 1 | |
fi | |
echo "container eth0: $IPV6_ADDRESS" | |
# get docker0's link local address | |
LINK_LOCAL=$( \ | |
ip addr show docker0 | \ | |
grep "inet6 fe80" | \ | |
awk '{print $2}' | \ | |
sed 's/\/.*//' \ | |
) | |
echo "docker0 link local: $LINK_LOCAL" | |
docker run -i -t \ | |
--lxc-conf="lxc.network.flags = up" \ | |
--lxc-conf="lxc.network.ipv6 = $IPV6_ADDRESS/126" \ | |
--lxc-conf="lxc.network.ipv6.gateway = $LINK_LOCAL" busybox:ubuntu-14.04 /bin/sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very good.