Enable IPv6 packet forwarding when using Docker
Using Docker 0.8.0 on Ubuntu 13.10 makes your exposed ports only bind to IPv6, but not to IPv4 interfaces. You see the effect quite fast when using netstat -lnt
.
Similar symptoms are described in several GitHub issues and StackOverflow questions. I solved the problem on my platform by editing the /etc/sysctl.conf
and uncommenting the following line:
net.ipv6.conf.all.forwarding=1
Details are described at my blog post, in a boot2docker issue and in even more detail at the according Docker issue.
Written by Tobias Gesellchen
Related protips
3 Responses
Thank you for posting this. Spared me several hours of headbanging. =P
I did same thing as you mentioned. (uncommented the line as you mentioned)
$ cat /etc/sysctl.conf | grep 'net.ipv6.conf.all.forwarding'
net.ipv6.conf.all.forwarding=1
Then I did this to apply above change
$ sudo sysctl -p
net.ipv6.conf.all.forwarding = 1
And after that I run
$ docker run -p 8080:8080 rajneesh/testimage
sudo netstat -anp |grep 8080
tcp6 0 0 :::8080 :::* LISTEN 28248/docker.io
but still I am unable to connect with my server from outside the world while there is no filtering mechanism on host machine.
I can see that issue is reported on docker https://github.com/docker/docker/issues/2174
but unable to find any working solution yet.
Hi,
would you mind adding your problem at the GitHub issue? I guess it would be more easier to discuss there.
I'm not sure if you need to restart the docker daemon after enabling the ipv6 forwarding - did you? It would also help to provide more details, like the output of the following commands:
$ uname -a
$ sysctl net.ipv6.conf.all.forwarding
$ sysctl net.ipv6.bindv6only
$ docker info
$ docker version