I have a linux server (Ubuntu 16.04) with a loopback interface (127.0.0.1) and a physical interface with a private ipv4 address (192.168.127.59).
I installed docker swarm and I create a cluster with a single node:
docker swarm init --advertise-addr 192.168.127.59
Then I created a service, for example nginx:
docker service create -p 8080:80 nginx
Now if I request the service from the private address, the service is reachable:
$ curl 192.168.127.59:8080
But if I request the service from the loopback address, it isn’t reachable:
$ curl 127.0.0.1:8080
I think that I should forward the services on the private IPv4 address to the loopback, but I don’t know what is the best way to accomplish it.