Docker-compose replicas with nginx reverse proxy

You don’t need to define the ports on the vote service, as the rproxy service is the one that handles the incomming requests. Traffic between rproxy and vote use a container network, which is not restricted in any way.

Also, there is no need to share all networks between the vote and rproxy service. It is sufficient to share a a single network between rproxy and target services. If you just use front-tier network it will be fine.

When it commes to you nginx.conf. make sure you read and follow the suggestions from here:

The problem and the fix is the same, regardless wether you deploy swarm stacks or docker-compose stacks.