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.

Host1:

  • Get and pass into container the host IP address
  • Why google drive change permission of the file and how to solve it?
  • sharing of OS image resources across multiple docker containers
  • RabbitMq Spring Boot deploy docker
  • AWS Cloudwatch logs with Docker Container - NoCredentialProviders: no valid providers in chain
  • script if version in package.json has changed
  •  public ip : 53.X.X.X 
     private ip : 172.X.X.X 
     docker ip : 173.16.42.1 (bridge ip)
    

    Host2:

     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 173.16.42.2: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 173.16.42.2: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 173.16.42.2:8080 from host2

    So any suggesation would be helpful

  • Docker push to private registry issues
  • docker how to commit but exclude directory from image
  • unable to start docker after upgrading to 1.12 version
  • Problems with docker container to container communication on same host when firewalld/iptables is enabled
  • Docker, web app static files. Best practices?
  • how to execute docker commands through Java program
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.