0

I have a host (Ubuntu), a docker container (centOS), a virtual machine (centOS).
- My Host has 2 interfaces, one is eth0 "192.168.0.4", one is docker0 "172.17.42.1"
- My docker container have IP "172.17.0.1". It has a service bind on port 80.
- On Virtual Machine, I use bridge adapter with docker0 and I config "/etc/sysconfig/network-scripts/ifcfg-eth0" file like this:

DEVICE="eth0"
ONBOOT=yes
HWADDR=08:00:27:72:40:6B
TYPE=Ethernet
BOOTPROTO=static
IPADDR=172.17.0.250
NETMASK=255.255.0.0

From host, I telnet to container's service

$ telnet 172.17.0.1 80
Trying 172.17.0.1...
Connected to 172.17.0.1.
Escape character is '^]'.

It is OK!
BUT, From Virtual Machine I cannot telnet to it

$ telnet 172.17.0.1 80
Trying 172.17.0.1...
telnet: Unable to connect to remote host: Connection timed out

From my Virtual Machine, I can ping the Docker Container

$ ping 172.17.0.1
PING 172.17.0.1 (172.17.0.1) 56(84) bytes of data.
64 bytes from 172.17.0.1: icmp_seq=1 ttl=64 time=0.091 ms

So, How to telnet to my service on Docker Container?

4
  • I flushed all iptables' rule. But I cannot telnet.
    – mahi
    Sep 25, 2015 at 2:20
  • Have you checked with netstat to see if there is something listening on that port? (netstat -an)
    – Rob
    Sep 25, 2015 at 2:51
  • @Rob: on my Docker Container, there is only my service on port 80.
    – mahi
    Sep 25, 2015 at 6:48
  • When a docker container is start, my host create a virtual interface called vethXXXX (eg: vethf345a6e). I used vethXXXX for bridge adapter of my VM. And everything is OK, the problem is resolved! BUT I don't understand about that.
    – mahi
    Sep 28, 2015 at 1:25

0

You must log in to answer this question.

Browse other questions tagged .