I have got an question, or better to say there are two ones. Both depends on Docker and is related to the understanding of how docker deals with containers hostnames and ports.
Let's say I have two services that are running in a different docker container and exposing port 80 from the container to port 8081 (service1) and port 8082 (service2):
service1 : 8081 : 80 service2: 8082 : 80
Now it is clear to me that from an host perspective I can access these services by using the exposed ports (http://localhost:8081 and http://localhost:8082). But what if I want to access my services by using the containers like http://container1 and http://container2? What I have to do to realize this szenario meaning:
- how might be the port forwarding
- and how I know the exact hostname so I could resolve the containers hostnames from the docker host machine?
Thanks for help!