title: How To Run Selenium With Chrome In Docker
body: <p>I installed google-chrome in a <a href="https://www.docker.com/" rel="noreferrer">Docker</a>, but when I run my <a href="https://www.python.org/downloads/release/python-272/" rel="noreferrer">Python 2</a> script of <a href="https://www.seleniumhq.org/download/" rel="noreferrer">Selenium</a>, it failed like this:</p>
  
  <pre><code>automation@1c17781fef0c:/topology-editor/test$ python test.py
  Traceback (most recent call last):
    File "test.py", line 27, in &lt;module&gt;
      browser = webdriver.Chrome()
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
      desired_capabilities=desired_capabilities)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
      self.start_session(desired_capabilities, browser_profile)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 185, in start_session
      response = self.execute(Command.NEW_SESSION, parameters)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 249, in execute
      self.error_handler.check_response(response)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
    (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-83-generic x86_64)
  </code></pre>
  
  <p>And if I run google-chrome directly in docker, it shows below:</p>
  
  <pre><code>automation@1c17781fef0c:/topology-editor/test$ google-chrome
  Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
  Trace/breakpoint trap (core dumped)
  automation@1c17781fef0c:/topology-editor/test$
  </code></pre>
  
  <p>System: </p>
  
  <pre><code>$ uname -a
  Linux 1c17781fef0c 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  $ google-chrome --version
  Google Chrome 60.0.3112.78
  $ chromedriver --version
  ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8)
  </code></pre>