in Education by
Suppose you have two services on your topology API Web Interface Both supposed to be running on port 80. On docker swarm when you create a service if you wanna access it outside the cluster you need to expose and map the port from the service to the nodes (external ports). But if you map port 80 to let's say API service then you cant map the same port for Web Interface service since it will be already mapped. How can this be solved? As far as I see this use case is not supported. Even though if you wanna have a big swarm cluster and through in there all your services and applications will not be possible because of this behavior. I'm missing something? Any pattern to solve this? Select the correct answer from above options

1 Answer

0 votes
by
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 \ /docker-flow-proxy 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.

Related questions

0 votes
    I want to expose multiple ports to the machine’s interface. How to achieve this using a docker container? Please help. Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    Now that links are deprecated in docker-compose.yml (and were able to use the new networking feature to ... docker-compose.yml? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am unable to find the containers under the directory: /var/lib/docker/containers Can you please tell me the ... the host machine? Select the correct answer from above options...
asked Jan 24, 2022 in Education by JackTerrance
0 votes
    I'm looking for a way to configure Nginx to access hosted services through a subdomain of my server. Those services ... me with this? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Do I need to use separate Docker containers for my complex web application or I can put all required services in ... in one container? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I've been using K8S ConfigMap and Secret to manage our properties. My design is pretty simple, that keeps ... 't been created Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    Can someone help me to differentiate between DevOps and Docker? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    My docker-compose file has some running docker files to create my containers. I don't want the docker files ... docker-compose syntax? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    I have created a docker image. I want to push it into my docker repo but I am facing this error: denied: ... to the resource is denied Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
0 votes
    I am trying to start the redis service on the Redis Server on Unbuntu 16.04 and I am facing this error: Failed ... you please help me? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    Could someone tell me how to start a DevOps career? Select the correct answer from above options...
asked Jan 6, 2022 in Education by JackTerrance
0 votes
    Does containerization affect a programming language being compiled/interpreted ? Eg: Python is interpreted. C is ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    What is the difference between Log stash and Kafka? Which one is better and how? Select the correct answer from above options...
asked Jan 25, 2022 in Education by JackTerrance
0 votes
    So I am trying to build a docker image with the Golang SDK, everything runs except the section in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I have tried to build a docker image based on mono to serve a docfx documentation. Here is my ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 15, 2022 in Education by JackTerrance
...