Docker / Selenium /无头Chrome:正确configurationSUID沙箱

我想运行我的docker集装箱中的selenium和无头铬进行testing。

我试图在我的.js文件中使用以下代码在无头镀铬区域(在Docker容器外)运行selenium。 这工作:

const client = webdriverio.remote({ desiredCapabilities: { browserName: 'chrome', chromeOptions: { args: ['--headless', '--disable-gpu'] }, binary: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' }, baseUrl: CONFIG.host, logLevel: 'verbose', waitForTimeout: 3000 }) 

但是我不能在我的docker集装箱里工作。 在我的docker集装箱,我使用“从selenium/独立铬”。 我的dockerfile似乎没有任何问题。 当我尝试运行我的seleniumtesting时出现问题。 我将.js文件中的binary_path更改为/ opt / google / chrome / google-chrome。 但是testing失败,客户端甚至无法启动。

所以我试着运行/ opt / google / chrome / google-chrome来查看chrome是否有效,但是我得到这个错误:

 [0711/005304.226472:ERROR:nacl_helper_linux.cc(311)] NaCl helper process running without a sandbox! Most likely you need to configure your SUID sandbox correctly 

我对这个(和堆栈溢出)很新,所以可能有一些基本的东西我已经错过了。

尝试包括--no-sandbox

 chromeOptions: { args: ['--headless', '--disable-gpu', '--no-sandbox'] }, 

正如我在dockerselenium