Docker Community Forums

Share and learn in the Docker community.

Docker internet connectivity lost in every container


(Andreapatricelli) #1

Hi all,

I’ve a strange issue with docker 1.7.1.
I’ve an ubuntu 14.04 64 bit machine.
After some problems with resolveconfig and internet connectivity with my system (finally solved restoring resolv.conf), I’m not able to have internet connection in every container any more. For example if I run docker run -i -t ubuntu ping google.com I get unknown host error, or if I try to build a container from debian image (previously working) apt-get fails to find its sources, etc.
I googled and found very few issues like mine, I tried to check for my iptables with sudo iptables -t nat -L -n but I got:

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
DOCKER     all  --  0.0.0.0/0           !127.0.0.0/8          ADDRTYPE match dst-type LOCAL

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
MASQUERADE  all  --  172.17.0.0/16        0.0.0.0/0           

Chain DOCKER (2 references)
target     prot opt source               destination      

I tried to set --dns option in docker default config, but nothing.
I have no proxy.
What kind of debug or check can I do to get a clue of what is the problem? Can you help me to restore connectivity?


(Jeff Anderson) #2

The unknown host error suggests that it may have something to do with DNS resolution. What is the contents of /etc/resolv.conf in an affected container? On your host?


(Andreapatricelli) #3

my resolv.conf is:

nameserver 127.0.1.1
nameserver 192.168.0.1
nameserver 8.8.8.8
search mylan.mycompany.com

docker container resolv.conf is:

nameserver 8.8.8.8
nameserver 8.8.8.4
search mylan.mycompany.com

It seems like it doesn’t find the DNS. I tried with ping 8.8.8.8 in my container and it worked, but it is not able to resolve anything.


(Jeff Anderson) #4

What happens if you try running dig google.com @8.8.8.8 in your container?


(Andreapatricelli) #5

I don’t know, I think that now it should work because I found some days ago, googling about docker DNS problem, a solution here:
https://robinwinslow.co.uk/2014/08/27/fix-docker-networking/