title: Docker swarm and communication between containers
body: <p>I have a very big problem I'm struggling with for 3 days.</p>
  
  <p>I use docker swarm on the remote server.
  20 microservices are in the same network NetA and stack StackA. </p>
  
  <p>Now I want to add Zipkin and Sleuth to my microservices to trace all requests.</p>
  
  <p>All microservices are made by docker-compose file that looks like:</p>
  
  <pre><code>version: '3'
  
  services:
    myservice1:
      image: myImage1
      depends_on:
        - myService2
        - myService3
      ports:
        - "8081:80"
      environment:
        - TZ=Europe/Warsaw
  
  
    myservice3:
      image: myImage2
      environment:
        - profile=${MY_PROFILE}
        - TZ=Europe/Warsaw
  
  ...
  </code></pre>
  
  <p>Now the question is - HOW to ADD Zipkin Server?</p>
  
  <p>I've added Zipkin server from Docker Hub Image.</p>
  
  <p>NOW my ZIpkin Service is:
  - in a separate network ZIPN
  - in a separate stack ZIPST</p>
  
  <p>What should I do to send data do Zipkin by all my microservices?
  What URL should i send in properties file:
  spring.zipkin.base-url=<a href="http://zipkinserver_network_zipkin_server:9411/" rel="nofollow noreferrer">http://zipkinserver_network_zipkin_server:9411/</a></p>
  
  <p>Should it be maybe:
  -container name (like my_zipkin_server) - but I use swarm so container name changes dynamically?
  - network name?</p>
  
  <p>I added an additional network NetA to my Zipkin container but it didn't solved my problem - there are no traces in my Zipkin UI.</p>
  
  <p>Please help me, I spent 4 days with this problem without any success.</p>
  
  <p>Zipkin server should be in a separate Stack because will be used by different applications.</p>
  
  <p>There is only ONE case when Zipkin works: when I set Zipkin container name:</p>
  
  <pre><code>spring.zipkin.base-url=http://zipkinserver_container_name:9411/
  </code></pre>