title: running python selenium in docker-compose
body: <p>I am trying to run python selenium in docker-compose. I have the following files:</p>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>version: '3'
  
  services:
    app:
      build:
        context: .
        dockerfile: Dockerfile
      depends_on:
        - chrome
      ports:
        - '8443:8443'
  
    chrome:
      image: selenium/node-chrome:3.14.0-gallium
      volumes:
        - /dev/shm:/dev/shm
      depends_on:
        - hub
      environment:
        HUB_HOST: hub
  
    hub:
      image: selenium/hub:3.14.0-gallium
      ports:
        - "4444:4444"
  </code></pre>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM    python:latest
  COPY    test.py /code/test.py
  WORKDIR /code
  RUN     pip install --upgrade pip
  RUN     pip install pytest
  RUN     pip install pytest-asyncio
  RUN     pip install selenium
  </code></pre>
  
  <p>test.py:</p>
  
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  
  driver = webdriver.Remote(
          command_executor='http://hub:4444/wd/hub',
          desired_capabilities=DesiredCapabilities.CHROME,
          )
  
  print(driver)
  </code></pre>
  
  <p>I run:</p>
  
  <pre><code>docker-compose build
  docker-compose run python test.py
  </code></pre>
  
  <p>And I get a connection-refused error in test.py when trying to create the webdriver.</p>
  
  <pre><code>'NewConnectionError('&lt;urllib3.connection.HTTPConnection object at 0x7ffb3b34d550&gt;: Failed to establish a new connection: [Errno 111] Connection refused')'
  </code></pre>
  
  <p>Looking at the logs, the hub and the chrome driver appear to be up and running and the chrome driver is connected to the hub. I can ping the hub and chrome containers from app. Any ideas?</p>