Docker Community Forums

Share and learn in the Docker community.

Inter container communication via exposed port from 1 container on same host


(Rajatbatra) #1

Environment:
CentoOS 6.5

IPTables -L output:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all – anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp – anywhere anywhere
ACCEPT all – anywhere anywhere
ACCEPT tcp – anywhere anywhere state NEW tcp dpt:ssh
REJECT all – anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER all – anywhere anywhere
ACCEPT all – anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all – anywhere anywhere
ACCEPT all – anywhere anywhere
REJECT all – anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (1 references)
target prot opt source destination

The scenario:

Host 1:
Container 1 exposes port 9101
Container 2 cannot reach port 9101
Host can reach port 9101

Host 2:
Container 1 can reach port 9101 on Host 1 without issue.

Until I turn of IPTABLES on Host 1, container 2 on the same host cannot access port 9101. I have the default -icc settings of true as best as i can tell.

Can someone help me understand if this is expected behavior or am i doing something wrong?


Docker container no route found to host ip on Centos 7