Docker Community Forums

Share and learn in the Docker community.

Docker networking V 1.9


(Kalyanasundaram) #1

Hi,

I have installed the docker V 1.9.1 on my Centos-7 Operating system. and i have one container and so we are able to communicate in between host machine and container, but not between an another host machine and container.

All host machine are same subnet (10.10.1.0) and docker subnet 172.147.0.1

Note: we are able to communicate from docker container to other network(private"another host machine" & public), but not from another host machine to docker container.

Could you please any one of you guide me?
-kalyan


(Brandon Mitchell) #2

This depends on your local routing and firewall policies on the host and other machines on the network (netstat -nr and iptables -vS). Typically, you would publish a port on the host with something like docker run -p 8080:80 nginx to publish port 8080 on the host and map that to port 80 on the container.


(Dvohra) #3

Set port forwarding to the other host.
For AWS an example:
ssh -i “pemfile.pem” -f -nNT -L host_IP:8081:172.17.0.3:80 ubuntu@ec2-52-91-200-41.compute-1.amazonaws.com

host_IP is the other host’s IP
8081 is the port on the other host
172.17.0.3 is the container ip forwarded to
ubuntu@ec2-52-91-200-41.compute-1.amazonaws.com is the Amazon EC2 DNS