Ubuntu: NAT not working in a container


Following instructions I've installed docker on ubuntu 13.04 (and 12.04 + 3.8 kernel), pulled the base container and started a shell inside it. It got a private IP and can ping it's default gateway but can't connect to any host outside, so no apt-get for me.

I have "net.ipv4.conf.all.forwarding = 1" in my sysctl and have POSTROUTING rules in iptables/nat table.

Did the docker installer forgot to add some rules or i'm missing something?


Do you have the MASQUERADE rule?

Can you try to start the daemon with docker -d -b testbr0 and try again?

This will create a new bridge and setup all iptables rules for it.

If it works, it probably mean a iptables -t nat -F occurred at some point and the nat rules for docker have been lost. You can either manually recreate them or more easily, remove the docker bridge and restart docker :)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »