Anda di halaman 1dari 3

moby / moby

Dismiss
Join GitHub today
GitHub is home to over 20 million developers working together to host
and review code, manage projects, and build software together.

Sign up

Networking fails inside newly created docker container. New issue

#1809
Closed kabhinav opened this issue on Sep 6, 2013 5 comments

kabhinav commented on Sep 6, 2013 Assignees

No one assigned
I have tried to install docker v0.6 on ubuntu 12.04 today. I have updated my kernel version, but I am unable
to get the networking working inside a container. The commands mentioned in #866 didn't help. Labels

None yet
$ uname -a
3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 16:19:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Projects
$sudo sysctl net.ipv4.ip_forward
None yet
net.ipv4.ip_forward = 1

$sudo iptables -L -t nat -n Milestone


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

Chain INPUT (policy ACCEPT) 3 participants


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 !172.17.0.0/16

Chain DOCKER (2 references)


target prot opt source destination

# docker -d
2013/09/05 17:56:30 WARNING: Your kernel does not support cgroup swap limit.
2013/09/05 17:56:30 Listening for HTTP on /var/run/docker.sock (unix)

$cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

$sudo docker run -i -t base ping www.google.com


ping: unknown host www.google.com

docker demon output:


2013/09/05 17:59:11 POST /v1.4/containers/create
2013/09/05 17:59:11 POST /v1.4/containers/d1f5475402ac/start
2013/09/05 17:59:11 POST /v1.4/containers/d1f5475402ac/resize?h=54&w=93
2013/09/05 17:59:11 POST /v1.4/containers/d1f5475402ac/attach?logs=1&stderr=1&stdin=1&stdout=1&stream=1

$sudo ifconfig
docker0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:172.17.42.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::24f9:29ff:fec3:205d/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1992 (1.9 KB) TX bytes:8743 (8.7 KB)
$sudo docker run -i -t base ifconfig
eth0 Link encap:Ethernet HWaddr 76:8c:63:3e:8f:a1
inet addr:172.17.0.2 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::748c:63ff:fe3e:8fa1/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:90 (90.0 B) TX bytes:90 (90.0 B)

lo Link encap:Local Loopback


inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

What am I doing wrong, can someone please help?

unclejack commented on Sep 8, 2013 Contributor

@kabhinav Can you ping the DNS servers from within the container? docker run -i -t ubuntu:12.10 ping
8.8.8.8

kabhinav commented on Sep 9, 2013

@unclejack yes, I am able to reach the DNS server.

$sudo docker run -i -t ubuntu:12.10 ping 8.8.8.8


WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: [8.8.8.8 8.8.4.4]
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=40 time=29.0 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=40 time=22.9 ms

$sudo docker run -i -t base ping 8.8.8.8


WARNING: Docker detected local DNS server on resolv.conf. Using default external servers: [8.8.8.8 8.8.4.4]
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=40 time=23.0 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=40 time=22.9 ms

unclejack commented on Sep 9, 2013 Contributor

@kabhinav Ok, the "base" image is no longer supported. The ubuntu images are the only supported
images.
This looks like some kind of problem with your setup, there doesn't seem to be anything wrong with
Docker. Given that you're able to ping the DNS servers, it seems that you're running into some kind of
problem with your network.

kabhinav commented on Sep 9, 2013

@unclejack specifying custom dns servers for my network solved the problems. The correct dns servers
were not specified in my system's /etc/resolv.conf file due to local network resolver in ubuntu 12.04.

sudo gedit /etc/NetworkManager/NetworkManager.conf

comment out the following line:

#dns=dnsmasq

sudo restart network-manager

now the /etc/resolv.conf should have correct dns addresses.

Thanks for pointing me in the right direction. Closing the issue.


20 3 3

kabhinav closed this on Sep 9, 2013

DakotaNelson referenced this issue on May 14, 2015

Docker unable to identify hosts #13207 Closed

ORESoftware commented 16 days ago edited

What is the restart command? service restart?

Anda mungkin juga menyukai