title: Selenium WebDriver - Process unexpectedly closed
body: <p>I have built a Docker image on top of Node to execute a bunch of Selenium tests.
  Here is my Dockerfile:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>#Dockerfile for individual node instance
  
  FROM node:latest
  
  #add the .js Selenium testcase files
  COPY ./tests /tests
  
  #add geckodriver (latest version) from local directory
  COPY geckodriver-v0.19.1-linux64.tar.gz /
  
  #set Path variable to firefox binary
  ENV Path="/firefox/firefox-bin"
  
  RUN ["mkdir","/firefox"]
  
  #download firefox executables
  RUN ["wget","-O","/firefox/ff.tar.bz2","https://download.mozilla.org/?product=firefox-latest-ssl&amp;os=linux64&amp;lang=de"]
  
  #unpack firefox executables
  RUN ["tar","xjf", "/firefox/ff.tar.bz2"]
  
  #unpack geckodriver
  RUN ["tar", "xzf", "geckodriver-v0.19.1-linux64.tar.gz"]
  
  #install webdriver on node
  RUN ["npm","install","selenium-webdriver@3.6.0"]
  
  #launch the test suite
  CMD ["node","/tests/suite.js"]
  #CMD ["tail","-f","/dev/null"]</code></pre>
  </div>
  </div>
  </p>
  
  <p>The code fails by executing the following initilization (the test cases in suite.js call the method init before doing anything):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>let obj = {
    driver: null,
    By: null,
    init: function() {
      let webdriver = require('selenium-webdriver'),
          By = webdriver.By,
          until = webdriver.until;
      
      let firefox = require('selenium-webdriver/firefox');
      //choose binary which was copied to the docker image
      let binary = new firefox.Binary('/firefox/firefox-bin');
      //run in headless mode
      binary.addArguments("-headless");
  
      let profile = new firefox.Profile();
      //add proxy
      profile.setPreference('network.proxy.type', 1);
      profile.setPreference('network.proxy.http', 'localhost');
      profile.setPreference('network.proxy.http_port', 8090);
      profile.setPreference('network.proxy.no_proxies_on', '');
      
      let options = new firefox.Options().setProfile(profile);
      options.setLogLevel(FirefoxDriverLogLevel.TRACE)
      options.setBinary(binary);
      
      obj.driver = new webdriver.Builder()
          .forBrowser('firefox')
          .setFirefoxOptions(options)
          .build();
      obj.By = webdriver.By;
      return obj;
    }</code></pre>
  </div>
  </div>
  </p>
  
  <p>However, the code above runs fine with my local node installation. But when i run the built docker image, it produces the following:</p>
  
  <p>WebDriverError: Process unexpectedly closed with status: 255
      at Object.throwDecodedError (/node_modules/selenium-webdriver/lib/error.js:514:15)
      at parseHttpResponse (/node_modules/selenium-webdriver/lib/http.js:519:13)
      at doSend.then.response (/node_modules/selenium-webdriver/lib/http.js:441:30)
      at 
      at process._tickCallback (internal/process/next_tick.js:160:7)
  From: Task: WebDriver.createSession()
      at Function.createSession (/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
      at Function.createSession (/node_modules/selenium-webdriver/firefox/index.js:521:41)
      at createDriver (/node_modules/selenium-webdriver/index.js:170:33)
      at Builder.build (/node_modules/selenium-webdriver/index.js:645:16)
      at Object.init (/tests/upik_lib.js:28:10)
      at Object. (/tests/upik_suite.js:1:97)
      at Module._compile (module.js:660:30)
      at Object.Module._extensions..js (module.js:671:10)
      at Module.load (module.js:573:32)</p>
  
  <p>I really dont have an idea of what went wrong here. I would expect to execute node to launch my selenium tests. I included Geckodriver and a firefox binary. 
  Any ideas?</p>