Confused about docker swarm mode networking

Hi, I am a little confused about docker swarm mode networking and how to actually bring up the website/service I have created.

first I have a 2 machine swarm setup with a manager and a worker. I have created a service using

docker service create --replicas=2 -p 80:80 --name NameofService imagename

This creates a service on both manager and worker. So far so good.

If I go to the http://manager_IPaddr the site does not render

if I do a docker inspect NameofService I see a virtual IP set

If I go to my site renders… it does not.

If I want to be able to access this site from external to this box is not going to work. Also each time I create a new service its going to generate a new virtual IP.

is there any documentation that would help show us what to do here and how to access the site from external to this 2 machine docker env?



a lot of information there:

I guess what you want is to use the ingress network so you can access your service from any nodes IP. If you need, you can then add a load balancer or a set keepalived on all nodes so you can have a floating IP that you will set as the NAT for your router.


Thanks for the reply.

I understand that but for some reason, I can only get to the service from the ingress IP that I see from

docker inspect NameofService

It seems like I cant get to the service through the node IP itself. I have 2 nodes and neither one renders the simple service(website)

is it because I set the port as 80?