title: Chromium hangs using the TestCafe Docker image
body: <p>Attempting to run Chromium headless inside the testcafe/testcafe Docker image causes the browser to hang, no matter what options I've used. Here's what I have at the moment:</p>
  
  <pre><code>"browsers": {
      "path": "/usr/bin/chromium-browser",
      "cmd": "--headless --disable-gpu --no-sandbox"
  }
  </code></pre>
  
  <p>And the output after a few minutes:</p>
  
  <pre><code>e2e_1  | Using locally installed version of TestCafe.
  e2e_1  | ERROR The HeadlessChrome 71.0.3578 / Linux 0.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.
  e2e_1  |
  e2e_1  | Type "testcafe -h" for help.
  </code></pre>
  
  <p>This works fine if I remove the <code>--headless</code>, but then the browser is rendering into Xvfb instead of running headlessly.</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM testcafe/testcafe
  
  USER root
  
  RUN apk --no-cache add \
      ffmpeg
  
  RUN mkdir /home/e2e
  WORKDIR /home/e2e
  COPY . .
  RUN chmod -R 757 /home/e2e
  
  USER user
  
  RUN npm install
  
  EXPOSE 1337 1338
  
  ENTRYPOINT ["/home/e2e/testcafe-docker.sh"]
  </code></pre>
  
  <p>testcafe-docker.sh:</p>
  
  <pre><code>#!/bin/sh
  XVFB_SCREEN_WIDTH=${SCREEN_WIDTH-1280}
  XVFB_SCREEN_HEIGHT=${SCREEN_HEIGHT-720}
  
  dbus-daemon --session --fork
  Xvfb :1 -screen 0 "${XVFB_SCREEN_WIDTH}x${XVFB_SCREEN_HEIGHT}x24" &gt;/dev/null 2&gt;&amp;1 &amp;
  export DISPLAY=:1.0
  fluxbox &gt;/dev/null 2&gt;&amp;1 &amp;
  testcafe --ports 1337,1338 "$@"
  </code></pre>
  
  <p>.testcaferc.json:</p>
  
  <pre><code>{
      "browsers": "chromium --no-sandbox",
      "src": ["tests/*"],
      "reporter": "spec",
      "screenshotPath": "tmp/screenshots/",
      "screenshotPathPattern": "${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png",
      "takeScreenshotsOnFails": true,
      "videoPath": "tmp/reports/screen-captures",
      "videoOptions": {
          "singleFile": true,
          "failedOnly": true,
          "pathPattern": "${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.mp4"
      },
      "videoEncodingOptions": {
          "r": 20,
          "aspect": "16:9"
      },
      "skipJsErrors": true,
      "concurrency": 1,
      "port1": 1337,
      "port2": 1338
  }
  </code></pre>
  
  <p>EDIT: I should correct myself that this does not work 100% of the time when I remove <code>--headless</code>, nor does it fail 100% of the time when it's headless. Either way, it intermittently passes one or two tests, and then fails. <strong>Firefox does pass 100% of the time.</strong> I've also been trying docker-compose a bit, but there's nothing too special in my docker-compose.yml, and the behavior seems the same.</p>