networking - Docker container binds to port, but I am unable to ping it -
i have running docker container (from this image). container seems running correctly far can see (the log-files looking , can connect via ssh container , use sqlplus inside it). however, unable connect container host.
i started container this:
sudo docker run -d -p 49160:22 -p 49161:1521 -p 49162:8080 alexeiled/docker-oracle-xe-11g
i inspected port-binding this:
$ sudo docker port <container> 8080 0.0.0.0:49162
and when sudo docker inspect <container>
among others this:
"networksettings": { "ipaddress": "172.17.0.2", "ipprefixlen": 16, "gateway": "172.17.42.1", "bridge": "docker0", "portmapping": null, "ports": { "1521/tcp": [ { "hostip": "0.0.0.0", "hostport": "49161" } ], "22/tcp": [ { "hostip": "0.0.0.0", "hostport": "49160" } ], "8080/tcp": [ { "hostip": "0.0.0.0", "hostport": "49162" } ] } },
when try ping container, container responds:
$ ping 172.17.0.2 ping 172.17.0.2 (172.17.0.2) 56(84) bytes of data. 64 bytes 172.17.0.2: icmp_req=1 ttl=64 time=0.138 ms 64 bytes 172.17.0.2: icmp_req=2 ttl=64 time=0.132 ms
but cannot connect host (windows) docker container. running docker inside ubuntu 12.04 virtual machine (in virtualbox on windows). not sure if problem docker, linux vm or virtualbox. forwarded bunch ports in virtualbox:
this result of sudo netstat -tpla
:
active internet connections (servers , established) proto recv-q send-q local address foreign address state pid/program name tcp 0 0 *:sunrpc *:* listen 542/rpcbind tcp 0 0 *:ssh *:* listen 1661/sshd tcp 0 0 *:51201 *:* listen 831/rpc.statd tcp 0 80 docker:ssh 10.0.2.2:62220 established 1902/sshd: vagrant tcp6 0 0 [::]:49160 [::]:* listen 2388/docker tcp6 0 0 [::]:49161 [::]:* listen 2388/docker tcp6 0 0 [::]:56105 [::]:* listen 831/rpc.statd tcp6 0 0 [::]:49162 [::]:* listen 2388/docker tcp6 0 0 [::]:sunrpc [::]:* listen 542/rpcbind tcp6 0 0 [::]:ssh [::]:* listen 1661/sshd
any idea why cannot connect windows (running) docker container?
update:
you configuration seems ok me, think ports 49160-49162 should bind ipv4 interface not ipv6. googled , seems encountered open bug in docker:
- https://github.com/dotcloud/docker/issues/2174
- https://serverfault.com/questions/545379/docker-will-only-bind-forwarded-ports-to-ipv6-interfaces
i see 2 solutions problem:
- completely disable ipv6 on ubuntu vm
- or bind directly ipv4 address: -p 172.17.42.1:49162:8080
answer before edit:
you can't ping ports. ping using icmp protocol.
in case cannot connect published port, can check if specific service in docker container bind proper network interface (f.e. 0.0.0.0) , not localhost. can check listening ports in container: netstat -tpla
.
Comments
Post a Comment