I have created a docker image which runs kafka inside the container. I have also done port mappings in the docker-compose.yml for mapping the host ports with container ports.
After bringing up the docker image (using docker-compose), I am able to see that the docker image is up and running and a container is also started as shown below:
e39cd6452307 dockerregistry:5000/confluent:latest "/run.sh" 10 hours ago Up 10 hours 0.0.0.0:8081->8081/tcp, 0.0.0.0:2108->2181/tcp, 0.0.0.0:9920->9092/tcp confluent
'ps-ef | grep docker' also provides me the following result:
root 6594 5257 0 Jan17 ? 00:00:00 docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9920 -container-ip 172.17.0.1 -container-port 9092
root 6605 5257 0 Jan17 ? 00:00:00 docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8081 -container-ip 172.17.0.1 -container-port 8081
root 6617 5257 0 Jan17 ? 00:04:22 docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2108 -container-ip 172.17.0.1 -container-port 2181
Weird thing starts here:
If I try to connect to service running inside the container from my host machine by using container IP and port (IP: 172.17.0.1, Port: 2181), my connection is successful and I get proper response.
However, If I try to connect to the service from host machine using the mapped host IP and port(using 10.xx.xx.xx:2108), I get a connection refused message. (xx is just used for masking my machine ip)
Also, 'telnet 10.xx.xx.xx 2108' works fine.
What could be the problem in this case. I have docker version 1.7.1 and docker-compose version 1.5.0
Please help.