Docker swarm networking hostnames and service names

As Swarn seems to expect each “service” you run in the cluster to be a replicated thing, I guess it makes sense it cannot publish the port if you are in rrdns mode.

Normally it forwards a port to a VIP, and the VIP load balances across the service containers. If you are in rrdsn, it cannot simply forward the port to the VIP, it would need to forward to one of the containers directly. I guess it could do that via round robin too, but its somewhat different.

What I am trying to do, is have a service which will only ever have 1 replica, but that does not seem compatible with how the port forwarding works. I guess I could work around this using a reverse proxy container like you said and publish any ports that way.

Ultimately, I guess I would like a way to have the VIPs but also make the internal nodes communicate using the IP too - kind of like 2 services names for each service. I’m not sure that is possible though.

1 Like