I run simple stateless NGINX service in 1.12 with overlay networking. However I need to access this service (or the containers) from non Dockerized environment. So my question is simple - how do I get exposed ports and related Docker hosts IPs of my NGINX containers?
If you use the --publish
flag for docker service
you can specify a “swarm port” which will listen for ingress to the specified service port on the designated port on all nodes of the cluster.
e.g., forward port 80
for the created service to 80
on all nodes:
$ docker service create --publish 80:80 nginx
7febr29nplab2w1ub5ruub40d
$ curl -4 localhost