How to access docker service with docker private ip and port from different host in aws without port forwarding or using docker host ip
I have the following setup, where both host are in same VPC.
public ip : 53.X.X.X private ip : 172.X.X.X docker ip : 22.214.171.124 (bridge ip)
public ip : 53.X.X.X private ip : 172.X.X.X
Now, when I launch container from host1, let’s say tomcat, how can I access this server with private and port from Host2?
I wanted like this from host2 126.96.36.199:8080.Added host1 nameserver in host2.
Basically, I wanted this use case because I am using consul for service discovery, and in consul service are registered as 188.8.131.52:8080. But when I do nslookup tomcat.service.consul I am able to resolve the service ip and port. But when I do a telnet or curl for this ip”port it times out. Allowed all traffic and iptables rule between hosts.
I am able to achive above usecase with port forwarding and accessing service using host ip.But i need the above approach 184.108.40.206:8080 from host2
So any suggesation would be helpful