-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Headless chrome is not working in the docker #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Another attempt:
|
I have the same issue.
|
Yes, I observed similar issue in node chrome image. Driver initialization got failed. |
Same here, can connect to the selenium service fine but Chrome fails to start.
|
Experiencing the same error. Built a new Docker image based on 35b5040 and I get:
Using Edit: Works fine with |
Ran Chrome goes idle really quickly in resource usage after starting though. |
I am also unable to connect to prefs = {
loggingPrefs: {
browser: 'ALL'
},
chromeOptions: {
prefs: {
credentials_enable_service: false, # disable saved passwords
profile: {
password_manager_enabled: false # disable saved passwords
}
},
'args' => %w{headless no-sandbox disable-gpu} # https://github.com/dkastner/headless-chromium-selenium/blob/master/features/support/env.rb
}
}
Selenium::WebDriver::Remote::Capabilities.chrome(prefs) It simply gives me a Am I mis-configuring headless mode? |
But chrome docs say:
When I run So it appears I have met all requirements and have a similar set of configurations as examples, yet still no response from the container. |
We are apparently having this same problem. This setup is working as expected when NOT using the "headless" option. However, as soon as we add the "headless" arguments to the chrome options, we get this dreadful error:
|
After few day search and try, finally I can run chrome headless mode by add option |
@viettd56 Sounds great! Do you perhaps have a code snippet of the full example :)? I'm sure it would help others as well. |
docker-compose.yml
|
@viettd56 Thanks! As a result, I realized in the docker call I can add I ran:
But now my code still just hangs, no clue why: from selenium import webdriver
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
options = webdriver.ChromeOptions()
URL = 'http://localhost:4444/wd/hub'
options.add_argument('--headless')
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--remote-debugin-port=9222")
options.add_argument("--screen-size=1200x800")
driver = webdriver.Remote(command_executor=URL,
desired_capabilities=options.to_capabilities()) Did you use python or ?? |
@kootenpv I seem that time I build custom docker container :D
and run this Dockerfile with option |
I've run the Maybe something you've done with that custom docker image which avoids this error? @viettd56 |
@cbrevik https://github.com/viettd56/docker-chrome-headless-example |
Experiencing the same error with --headless |
I'm facing failures in Java/Scala as well when running using Scala code to create the headless driver:
LOGs in Docker images (
LOGs in the console running the test:
|
Faced the same issue with Chrome v:61.0.3163.91 and ChromeDriver 2.32.498513 and Selenium 3.5.3. |
I just started an image in
Running |
+1 Getting the "Message: unknown error: Chrome failed to start: exited normally" error as well...
Running via Codeception (tried every option/capability under the sun from various threads on this issue to no avail). My Codeceptionn config below (not working).
Hope this gets fixed soon! |
chromedriver issue looks related: https://bugs.chromium.org/p/chromedriver/issues/detail?id=1972 |
I just tried the commands shown in this comment, with the current selenium/standalone-chrome-debug:3.6.0-bromine release, and they work. One main difference with the previous version, is that the wrapper to launch Google Chrome was changed (it was pretty old). That could explain why all these options didn't work before. Could you please try again and report back? |
@diemol: I've updated my images with Here's the result:
Thank you very much! |
Great! Closing the issue then. |
Are there any pointers on how to use the chrome-debug image in a docker-compose file? |
We need to use a docker-compose file because we are using a gradle plugin to do the compose up. With this plugin (avast) you cannot specify the ports. FWIW, changing the image to selenium/standalone-chrome-debug in the docker-compose file fails spectacularly. the debug chrome containers cannot attach to the hub. |
run into same issue in my self build docker (debian 9 based), adding "no-sandbox" works. "privileged" or "disable-gpu" is not necessary. run as normal user (not root). options = webdriver.ChromeOptions()
options.add_argument("headless")
#options.add_argument("privileged")
options.add_argument("no-sandbox")
#options.add_argument("disable-gpu")
options.add_argument("window-size=1200x800")
self.browser = webdriver.Chrome(chrome_options=options) |
@loblab I've been struggling with this issue for days. I cant believe a single "no-sandbox" solved the issue! Anyways. Thanks a bunch!!!! |
Image:
Container:
Stack trace of not working (it times out):
The text was updated successfully, but these errors were encountered: