Can we deploy the same service in same worker node when we publish the port ?
Let’s say I have 3 workers and 1 manager.
I want to deploy nginx with replicas = 4 and publish port 80.
That means I’ll get 2 nginx in the same worker, but we can’t listen on port 80 for 2 application.
How does swarm handle that please ?
3 workers and 1 manager means you have 4 instances where nginx could run.
port 80 will be listened by a load balancer by default. Port 80 will also with just one replica be available on each node.
You could run 10 or more nginx. They will be served by round robin.
Thanks for your reply.
There is just one thing I didn’t understand, is when I a create a new service with this command : --publish-add 8080:80 my-web. Does that mean that it will use the port 8080 of the host? And that port will be deployed only once by node?