Skip to content

Commit

Permalink
Disable chrome sandbox when inside docker
Browse files Browse the repository at this point in the history
  • Loading branch information
rtsao committed Jan 4, 2018
1 parent 2f92c44 commit a848bb3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/run-chrome.js
Expand Up @@ -6,6 +6,7 @@ const path = require('path');
const http = require('http');
const {PassThrough} = require('stream');
const getPort = require('get-port');
const isDocker = require('is-docker');

const CDP = require('chrome-remote-interface');

Expand All @@ -23,7 +24,10 @@ async function runChrome(entry, cb) {
const errstream = PassThrough();

const chromeInstance = await chromeLauncher.launch({
chromeFlags: ['--headless', '--disable-gpu'],
chromeFlags: ['--headless', '--disable-gpu'].concat(
// TODO: remove this flag when supported
isDocker() ? ['--no-sandbox'] : []
),
});

const port = chromeInstance.port;
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -19,6 +19,7 @@
"chrome-launcher": "^0.10.0",
"chrome-remote-interface": "^0.25.5",
"get-port": "^3.2.0",
"is-docker": "^1.1.0",
"istanbul-lib-coverage": "^1.1.1",
"merge2": "1.2.0",
"minimist": "^1.2.0",
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Expand Up @@ -1705,6 +1705,10 @@ is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"

is-docker@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-1.1.0.tgz#f04374d4eee5310e9a8e113bf1495411e46176a1"

is-dotfile@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1"
Expand Down

0 comments on commit a848bb3

Please sign in to comment.