title: How to link selenium standalone docker container properly with host networking?
body: <p>I'm running two docker containers as follows:  </p>
  
  <p>one is for <a href="https://github.com/SeleniumHQ/docker-selenium/tree/master/StandaloneChrome" rel="nofollow noreferrer">selenium/standalone-chrome</a></p>
  
  <pre class="lang-sh prettyprint-override"><code>$ docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome
  </code></pre>
  
  <p>and the main container uses host networking to connect to MySQL which is running on localhost</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ docker run --rm --network="host" $(IMAGE_REPO)
  </code></pre>
  
  <p>but when I tried to initiate the driver in the main container</p>
  
  <pre class="lang-py prettyprint-override"><code>from selenium import webdriver
  driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub', 
                  desired_capabilities=webdriver.DesiredCapabilities.CHROME)
  </code></pre>
  
  <p>I got error message which is either  </p>
  
  <p><code>urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",))</code></p>
  
  <p>or</p>
  
  <p><code>urllib3.exceptions.ProtocolError: ('Connection aborted.', error(104, 'Connection reset by peer'))</code></p>
  
  <p>did I forget anything / any parameters when trying to establish the containers? or the value passing to <code>command_executor</code> should not be <code>'http://127.0.0.1:4444/wd/hub'</code>?</p>
  
  <p>I also tried to use docker bridge networking, but then I have no idea how to connect to MySQL server on localhost</p>
  
  <pre class="lang-py prettyprint-override"><code>SQLALCHEMY_URI = '{driver}://{user}:{pwd}@{host}/{db}?charset=utf8' \
  .format(
      driver='mysql+pymysql',
      host='127.0.0.1:3306',
      user='root',
      pwd='0000',
      db='default'
  )
  </code></pre>