title: can not use user-defined bridge in swarm compose yaml file
body: <p>I learned from <a href="https://docs.docker.com/engine/userguide/networking/#user-defined-networks" rel="nofollow noreferrer">docker documentation</a> that I can not use docker DNS to find containers using their hostnames without utilizing user-defined bridge network. I created one using the command:</p>
  <pre><code>docker network create --driver=overlay --subnet=172.22.0.0/16 --gateway=172.22.0.1 user_defined_overlay
  </code></pre>
  <p>and tried to deploy a container that uses it. compose file looks like:</p>
  <pre><code>  version: &quot;3.0&quot;
      services:
        web1:
          image: &quot;test&quot;
          ports:
             - &quot;12023:22&quot;
          hostname: &quot;mytest-web1&quot;
          networks:
            - test
        web2:
          image: &quot;test&quot;
          ports:
             - &quot;12024:22&quot;
          hostname: &quot;mytest-web2&quot;
          networks:
            - test
      networks:
        test:
          external: 
            name: user_defined_overlay
  </code></pre>
  <p>my docker version is: <code>Docker version 17.06.2-ce, build cec0b72</code>
  and I got the following error when I tried deploying the stack:</p>
  <pre><code>network &quot;user_defined_bridge&quot; is declared as external, but it is not in the right scope: &quot;local&quot; instead of &quot;swarm&quot;
  </code></pre>
  <p>I was able to create an overlay network and define it in compose file. that worked fine but it didn't for bridge.
  result of docker network ls:</p>
  <pre><code>NETWORK ID          NAME                       DRIVER              SCOPE
  cd6c1e05fca1        bridge                     bridge              local
  f0df22fb157a        docker_gwbridge            bridge              local
  786416ba8d7f        host                       host                local
  cuhjxyi98x15        ingress                    overlay             swarm
  531b858419ba        none                       null                local
  15f7e38081eb        user_defined_overlay       overlay             swarm
  </code></pre>
  <p><strong>UPDATE</strong></p>
  <p>I tried creating two containers running on two different swarm nodes(1st container runs on manager while second runs on worker node) and I specified the user-defined overlay network as shown in stack above. I tried pinging mytest-web2 container from within mytest-web1 container using hostname but I got <code>unknown host mytest-web2</code></p>