title: How is load balancing done in Docker-Swarm mode
body: <p>I'm working on a project to set up a cloud architecture using docker-swarm. I know that with swarm I could deploy replicas of a service which means multiple containers of that image will be running to serve requests. </p>
  
  <p>I also read that docker has an internal load balancer that manages this request distribution. </p>
  
  <p><strong><em>However, I need help in understanding the following:</em></strong></p>
  
  <p>Say I have a container that exposes a service as a REST API or say its a web app. And If I have multiple containers (replicas) deployed in the swarm and I have other containers (running some apps) that talk to this HTTP/REST service. </p>
  
  <p>Then, when I write those apps which <strong>IP:PORT</strong> combination do I use? Is it any of the worker node IP's running these services? Will doing so take care of distributing the load appropriately even amongst other workers/manager running the same service?</p>
  
  <p>Or should I call the manager which in turn takes care of routing appropriately (even if the manager node does not have a container running this specific service)?</p>
  
  <p>Thanks.</p>