title: Docker swarm node unable to detect service from another host in swarm
body: <p>My goal is to set up a docker swarm on a group of 3 linux (ubuntu) physical workstations and run a <a href="https://distributed.readthedocs.io/en/latest/" rel="nofollow noreferrer">dask</a> cluster on that.</p>
  
  <pre><code>$ docker --version
  Docker version 17.06.0-ce, build 02c1d87
  </code></pre>
  
  <p>I am able to init the docker swarm and add all of the machines to the swarm.</p>
  
  <pre><code>cordoba$ docker node ls
  ID                            HOSTNAME    STATUS    AVAILABILITY MANAGER STATUS
  j8k3hm87w1vxizfv7f1bu3nfg     box1        Ready     Active              
  twg112y4m5tkeyi5s5vtlgrap     box2        Ready     Active              
  upkr459m75au0vnq64v5k5euh *   box3        Ready     Active              Leader
  </code></pre>
  
  <p>I then run <code>docker stack deploy -c docker-compose.yml dask-cluster</code> on the Leader box.</p>
  
  <p>Here is <code>docker-compose.yml</code>:</p>
  
  <pre><code>version: "3"
  
  services:
  
    dscheduler:
      image: richardbrks/dask-cluster
      ports:
       - "8786:8786"
       - "9786:9786"
       - "8787:8787"
      command: dask-scheduler
      networks:
        - distributed
      deploy:
        replicas: 1
        restart_policy:
          condition: on-failure
        placement:
          constraints: [node.role == manager]
  
    dworker:
      image: richardbrks/dask-cluster
      command: dask-worker dscheduler:8786
      environment:
        - "affinity:container!=dworker*"
      networks:
        - distributed
      depends_on:
        - dscheduler
      deploy:
        replicas: 3
        restart_policy:
          condition: on-failure
  
  networks:
    distributed:
  </code></pre>
  
  <p>and here is <code>richardbrks/dask-cluster</code>:</p>
  
  <pre><code># Official python base image
  FROM python:2.7    
  # update apt-repository
  RUN apt-get update
  # only install enough library to run dask on a cluster (with monitoring)
  RUN pip install --no-cache-dir \
      psutil \
      dask[complete]==0.15.2 \
      bokeh
  </code></pre>
  
  <p>When I deploy the swarm, the <code>dworker</code> nodes that are not on the same machine as <code>dscheduler</code>
  does not know what <code>dscheduler</code> is. I ssh'd into one of these nodes and looked in env,
  and <code>dscheduler</code> was not there. I also tried to ping <code>dscheduler</code>, and got "ping: unknown host".</p>
  
  <p>I thought docker was supposed to provide an internal dns based for service discovery
  so that calling <code>dscheduler</code> will take me to the address of the <code>dschedler</code> node.</p>
  
  <p>Is there some set up to my computers that I am missing? or are any of my files missing something?</p>
  
  <p>All of this code is also located in <a href="https://github.com/MentalMasochist/dask-swarm" rel="nofollow noreferrer">https://github.com/MentalMasochist/dask-swarm</a></p>