Docker and IPv6 on Ubuntu 13.10 (Saucy Salamander)

After making myself familiar with Docker I wanted to use it on a more recent Ubuntu 13.10 release. I still didn’t install Docker natively on my pc, but use a Vagrant box to play with fresh releases. After downloading a fresh Ubuntu 13.10 image, creating a VirtualBox image and installing the current Docker release 0.8.0, I tried to use my other little toys CouchDB and Elasticsearch in Docker containers. Sadly, I couldn’t connect to the exposed ports anymore.

The Docker installation docs for Ubuntu Linux 13.04 and 13.10 mention the configuration of UFW to modify the DEFAULT_FORWARD_POLICY to accept all traffic. Well, the UFW wasn’t enabled. So the usual digging began, searching on StackOverflow, GitHub and developer blogs. Most hints mentioned disabling the IPv6 support via sysctl, but a quite clear statement of Jérôme Petazzoni at a StackOverflow answer made me search for alternatives.

Instead of disabling IPv6 some people found a way to enable IPv6 inside of containers: Andreas Neuhaus showed some native lxc commands to make containers support IPv6. Marek Goldmann also shows some other use cases for native lxc commands to connect containers on multiple hosts. Well, hopefully a pull request to make Docker natively support IPv6 will merged soon. My problem didn’t look like missing IPv6 support inside the container, though.

Some debugging, bridge configuration, iptables fun and interface setups later I came back to the sysctl config and had a look at the existing entries. You might by surprised how well each default entry is documented and especially one entry looked promising: I enabled IPv6 forwarding on all interfaces by uncommenting the entry with: net.ipv6.conf.all.forwarding=1 in the /etc/sysctl.conf. A quick reboot later finally showed a response from the dockerized CouchDB. Relax! Sometimes it’s too easy.

Now comes the fun part with reconnecting the CouchDB River Plugin for ElasticSearch over different containers again :)