title: Docker swarm scaling behaviour on port mapping
body: <p>I have a swarm composed of three nodes:</p>
  
  <pre><code>$ sudo docker node ls
  ID                            HOSTNAME         STATUS              AVAILABILITY        MANAGER STATUS
  i12s3zxsn4vu1c98bv3i5idr8     node03           Ready               Active
  i2ckxvsju4tmommxim3dbfq7l     node02           Ready               Active
  wak4isl46dn7pbo39drrhphju *   node01           Ready               Active              Leader
  </code></pre>
  
  <p>Then I run 1 replica of nginx on that swarm and map his port to 8080:</p>
  
  <pre><code>$ sudo docker service create --replicas 1 --publish 8080:80 --name nginx nginx
  $ sudo docker service ls
  ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
  neahnb9mvi1i        nginx               replicated          1/1                 nginx:latest        *:8080-&gt;80/tcp
  </code></pre>
  
  <p>From there, i can reach nginx on <a href="http://node01:8080" rel="nofollow noreferrer">http://node01:8080</a></p>
  
  <p>Next, I scale nginx instances to 6:</p>
  
  <pre><code>$ sudo docker service scale nginx=6
  $ sudo docker service ls
  ID                  NAME                MODE                REPLICAS            IMAGE               PORTS
  neahnb9mvi1i        nginx               replicated          6/6                 nginx:latest        *:8080-&gt;80/tcp
  </code></pre>
  
  <p>From there, i'm still able to reach nginx on <a href="http://node01:8080" rel="nofollow noreferrer">http://node01:8080</a>.</p>
  
  <p>However, if docker swarm expose several node as a unique host, how does he manage the port during such a scaling operation as all my nginx services are mapped on the same 8080 port?  Is there a round robin load balancing between all services instances done by swarm internally and returning the answer on 8080?</p>