Closed Quramy closed 7 years ago
Hi,
I was getting this issue as well. For me adding the --privileged
flag when running docker run
resolved the issue.
The complete command I ran when starting the Docker container was: docker run -it --privileged -v $(pwd):${MOUNT_POINT} ${DOCKER_IMAGE} bash
Hope that helps you too!
I tried --privileged
flag on my local Docker host and the error was removed.
I don't know how to customise this flag on Wercker CI, so I'll search for information a little more.
Thanks!
There is no need to start a privileged container, turning off the chrome sandbox with --no-sandbox
is enough. Added the following to my karma.conf.js
:
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox', // required to run without privileges in docker
'--user-data-dir=/tmp/chrome-test-profile',
'--disable-web-security'
]
}
},
Hi @hoeck
I agree that's a better solution if it works. However, it didn't work for me at the time I wrote the above comment (and I haven't retried it).
Where this file is located karma.conf.js ? I do not see any such file while made a find / -name "karma.conf.js" inside the container as root user.
There is no need to start a privileged container, turning off the chrome sandbox with
--no-sandbox
is enough. Added the following to mykarma.conf.js
:browsers: ['ChromeHeadlessNoSandbox'], customLaunchers: { ChromeHeadlessNoSandbox: { base: 'ChromeHeadless', flags: [ '--no-sandbox', // required to run without privileges in docker '--user-data-dir=/tmp/chrome-test-profile', '--disable-web-security' ] } },
For continuous integration, it will be better setting them with a variable. So that you can run tests on your local with real browsers while you are testing it with headless in CI.
karma.conf.js
const isBuild = process.env.CI;
let settings = {
....
....
....
}
if (isBuild) {
settings = {
...settings,
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
};
}
config.set(settings);
There is no need to start a privileged container, turning off the chrome sandbox with
--no-sandbox
is enough. Added the following to mykarma.conf.js
:browsers: ['ChromeHeadlessNoSandbox'], customLaunchers: { ChromeHeadlessNoSandbox: { base: 'ChromeHeadless', flags: [ '--no-sandbox', // required to run without privileges in docker '--user-data-dir=/tmp/chrome-test-profile', '--disable-web-security' ] } },
worked for me , thank u.
Hi. I want to run
ChromeHeadless
on CI services.I could not launch
google-chrome --headless
because the following error:Is there some workarounds?
I tried to run in local env(macOS Chrome canary), and it works well.