title: Docker Swarm - cannot access the service from the same Host (it works if using docker-compose without stack)
body: <p>I have a service which is being accessed from other container, and also from the host itself.
  definition in docker-compose.yaml</p>
  <pre><code>version: &quot;3.8&quot;
  services:
    ads:
      image: cloud.dev/ads:test1
      container_name: ads
      hostname: ads
      ports:
        - &quot;9001:9000&quot;
  </code></pre>
  <p>Other containers access this service with <code>ads:9000</code> while I access from the Host with <code>ads:9001</code> to that application and it works!</p>
  <p>Then I tested <code>docker swarm</code>.
  I created a stack <code>ams_stack</code>
  And I defined my <code>ads</code> service for <code>ams_stack</code></p>
  <pre><code>version: &quot;3.8&quot;
  services:
    ads:
      image: cloud.dev/ads:test1
      deploy:
        replicas: 1
        placement:
          constraints:
            - &quot;node.role==worker&quot;
      hostname: ams_stack_ads
      ports:
        - &quot;9001:9000&quot;
  </code></pre>
  <p>I see that service is being run!</p>
  <pre><code>6b0f8d514f02    cloud.dev/ads:test1   &quot;dssrv_mssql.exe -ad…&quot;   3 hours ago   Up 3 hours    ams_stack_ads.1.owmej7byvzhnwud98dwmo4joe
  </code></pre>
  <p>So I tried to access with:</p>
  <pre><code>ams_stack_ads:9001
  ams_stack_ads:9000
  ads:9001
  ads:9000
  </code></pre>
  <p>nothing works... please help...Thanks</p>