summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2020-06-26 11:18:00 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-26 11:19:12 -0700
commit47ac142dc9b440c90cdc037c77ab80c47263f9e2 (patch)
tree73714c1b45e2a388156f20e1ad5ac6b5b7d70021
parent7fb6cc286fffab2f408a5dbc228e0db706104682 (diff)
Enable docker IPv6 in kokoro
We need docker IPv6 for ip6tables tests. Docker has spotty IPv6 support, so just enabling IPv6 in daemon.json breaks the Ruby image test (AFAICT it breaks anything that tries to use IPv6 to reach the internet). An ip6tables NAT rule is added to handle this. We could make these changes as part of scripts/, but these would overwrite global values and possibly break users' systems. PiperOrigin-RevId: 318508209
-rwxr-xr-xtools/vm/ubuntu1604/25_docker.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/vm/ubuntu1604/25_docker.sh b/tools/vm/ubuntu1604/25_docker.sh
index 11eea2d72..53d8ca588 100755
--- a/tools/vm/ubuntu1604/25_docker.sh
+++ b/tools/vm/ubuntu1604/25_docker.sh
@@ -52,3 +52,14 @@ while true; do
exit $result
fi
done
+
+# Enable Docker IPv6.
+cat > /etc/docker/daemon.json <<EOF
+{
+ "fixed-cidr-v6": "2001:db8:1::/64",
+ "ipv6": true
+}
+EOF
+# Docker's IPv6 support is lacking and does not work the same way as IPv4. We
+# can use NAT so containers can reach the outside world.
+ip6tables -t nat -A POSTROUTING -s 2001:db8:1::/64 ! -o docker0 -j MASQUERADE