IP address + port. So things get messy when multiple services are listing on (for example) port 8080.
You can handle things from each other using overlay networking in swarm mode, But there is a problem coming in when you have to connect your services to the proxy (ie:-overlay network) - at that point, it looks like things get mixed up.
The solution for these things not to get mixed up is to let the services that need to be exposed to the net use ports unique as far as the proxy-facing network is concerned.
For this, we need to follow the following example.
Create two docker networks of overlay
docker network create --driver overlay proxy
docker network create --driver overlay my-app
Creating a proxy network
docker service create --network proxy --network my-app --name app1 myApp1DockerImage
docker service create --name proxy \
-p 80:80 \
-p 443:443 \
-p 8080:8080 \
--network proxy \
-e MODE=swarm \
Now with this, you can go through the proxy networks now you can start my app service with the previous docker image so that the app1 will be running on port 8081 and app2 will be exposed on port 8080.