title: Docker for AWS and Selenium Grid - Connection refused / No route to host (Host unreachable)
body: <p>What I am trying to achieve is a scalable and on-demand test infrastructure using Selenium Grid.</p>
  
  <p>I can get everything up and running but what I end up with is this:</p>
  
  <p><a href="https://i.stack.imgur.com/gsu73.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gsu73.png" alt="enter image description here"></a></p>
  
  <p>Here are all the pieces:</p>
  
  <ol>
  <li><a href="https://blog.docker.com/2016/11/docker-aws-public-beta/" rel="nofollow noreferrer">Docker for AWS</a> (CloudFormation Stack)</li>
  <li><a href="https://github.com/SeleniumHQ/docker-selenium%22docker-selenium%22" rel="nofollow noreferrer">docker-selenium</a></li>
  <li>Docker compose file (below)</li>
  </ol>
  
  <p>The "implied" software used are:</p>
  
  <p><a href="https://docs.docker.com/engine/swarm/" rel="nofollow noreferrer">Docker swarm</a></p>
  
  <p><a href="https://docs.docker.com/docker-cloud/apps/stacks/" rel="nofollow noreferrer">Stacks</a></p>
  
  <p>Here is what I can accomplish:</p>
  
  <ol>
  <li><p>Create, log into, and ping all hosts &amp; nodes within the stack, following the guidelines here: <a href="https://docs.docker.com/docker-for-aws/deploy/" rel="nofollow noreferrer">deploy Docker for AWS</a></p></li>
  <li><p>Deploy using the compose the file at the end of this inquiry by running:</p>
  
  <pre><code>docker stack deploy -c docker-compose.yml grid
  </code></pre></li>
  <li><p>View Selenium Grid console using the public facing DNS name automatically provided by AWS (upon successful creation of the stack). Here is a helpful entry on the subject: <a href="https://stelligent.com/2017/02/21/docker-swarm-mode-on-aws/" rel="nofollow noreferrer">Docker Swarm Mode</a>.</p></li>
  </ol>
  
  <p>Here is are the contents of the compose file I am using:</p>
  
  <pre><code>version: '3'
  
  services:
    hub:
      image: selenium/hub:3.4.0-chromium
      ports:
        - 4444:4444
      networks:
        - selenium
      environment:
        - JAVA_OPTS=-Xmx1024m
      deploy:
        update_config:
          parallelism: 1
          delay: 10s
        placement:
          constraints: [node.role == manager]
  
    chrome:
      image: selenium/node-chrome:3.4.0-chromium  
      networks:
        - selenium
      depends_on:
        - hub
      environment:
        - HUB_PORT_4444_TCP_ADDR=hub
        - HUB_PORT_4444_TCP_PORT=4444
      deploy:
      placement:
        constraints: [node.role == worker]
  
    firefox:
      image: selenium/node-firefox:3.4.0-chromium
      networks:
        - selenium
      depends_on:
        - hub
      environment:
        - HUB_PORT_4444_TCP_ADDR=hub
        - HUB_PORT_4444_TCP_PORT=4444
      deploy:
      placement:
        constraints: [node.role == worker]
  
  networks:
    selenium:
  </code></pre>
  
  <p>Any guidance on this issue will be greatly appreciated. Thank you.</p>
  
  <p>I have also tried opening up ports across the swarm:</p>
  
  <pre><code>swarm-exec docker service update --publish-add 5555:5555 gird
  </code></pre>