I have two containers in a stack. An nginx reverse proxy, and a simple nodejs ‘hello world’ app.
There are two nodes in the swarm.
The reverse proxy deploys in ‘global’ mode, and its port 80 is mapped to host’s port 80. The reverse proxy is configured to proxy_pass requests to the simple ‘hello world’.
The simple ‘hello world’ app deploys with just 1 (one) replica.
In all tests, I send an http request to the one of the nodes only. Alternately, I get 200 and 502.
When mesh routes to the proxy on the same node as the simple ‘hello world’ app, the proxy works: 200.
When the mesh routes to proxy on the other node, fail. 502. The proxy log complains ‘no route to host’.
When I inspect the stack’s network, the host sought does not exist.
Here is the reverse proxy’s error:
2017/12/06 21:46:27 [error] 5#5: *3 connect() failed (113: No route to host) while connecting to upstream, client: 10.255.0.2, server: router, request: “GET /hello HTTP/1.1”, upstream: “http://10.0.0.5:8080/hello”, host: “10.133.142.132”
10.0.0.5 does not show in output of ‘network inspect stack-network’ on either node. Also, the address of the target, simple ‘hello world’ app, is not 10.0.0.5.
I’ve tested/confirmed the required swarm ports are open, as per https://docs.docker.com/engine/swarm/swarm-tutorial/#open-protocols-and-ports-between-the-hosts
I’m seeking suggestions on how to debug.
Docker 17.06.
Thanks,
John