Skip to content

Guidance To Run In Docker #49

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

Closed
barrycarey opened this issue Feb 4, 2025 · 5 comments
Closed

Guidance To Run In Docker #49

barrycarey opened this issue Feb 4, 2025 · 5 comments
Labels
question Further information is requested stale

Comments

@barrycarey
Copy link
Contributor

barrycarey commented Feb 4, 2025

Hello,

I'll start by saying I know there's a template repo for a Docker build. However, I'm attempting to integrate with an existing project so I was trying to avoid using that repo if possible.

I've tried a few different variations including the Python base image with Chrome installed. An Alpine base image with VNC installed. Basically this example for UC.

They always yield the same results, logs below.

Any advice on what I might be missing?

nodriver  | 2025-02-04 04:09:49,060 - selector_events:__init__:64 - [1][MainThread] - DEBUG: Using selector: EpollSelector
nodriver  |2025-02-04 04:09:49,064 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/google-chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,064 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,064 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,064 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,064 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/google-chrome-stable is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/sbin/google-chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/sbin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/sbin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/sbin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/sbin/google-chrome-stable is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/google-chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/local/bin/google-chrome-stable is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,065 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/sbin/google-chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,066 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/sbin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,066 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/sbin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,066 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/sbin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,066 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/sbin/google-chrome-stable is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,067 - config:find_chrome_executable:297 - [1][MainThread] - DEBUG: /usr/bin/google-chrome is a valid candidate...
nodriver  |2025-02-04 04:09:49,067 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/bin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/bin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /usr/bin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:297 - [1][MainThread] - DEBUG: /usr/bin/google-chrome-stable is a valid candidate...
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /sbin/google-chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /sbin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /sbin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /sbin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /sbin/google-chrome-stable is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:297 - [1][MainThread] - DEBUG: /bin/google-chrome is a valid candidate...
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /bin/chromium is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /bin/chromium-browser is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:300 - [1][MainThread] - DEBUG: /bin/chrome is not a valid candidate because don't exist or not executable
nodriver  |2025-02-04 04:09:49,068 - config:find_chrome_executable:297 - [1][MainThread] - DEBUG: /bin/google-chrome-stable is a valid candidate...
nodriver  | 2025-02-04 04:09:49,068 - config:__init__:102 - [1][MainThread] - INFO: detected root usage, autoo disabling sandbox mode
nodriver  | 2025-02-04 04:09:49,068 - browser:__init__:131 - [1][MainThread] - DEBUG: Session object initialized: {'config': Config
nodriver  |     browser_executable_path = /bin/google-chrome
nodriver  |     autodiscover_targets = True
nodriver  |     lang = en-US
nodriver  |     browser_connection_timeout = 0.25
nodriver  |     browser_connection_max_tries = 10
nodriver  |     browser_args = ['--disable-background-networking', '--disable-backgrounding-occluded-windows', '--disable-breakpad', '--disable-component-update', '--disable-dev-shm-usage', '--disable-features=IsolateOrigins,site-per-process', '--disable-infobars', '--disable-renderer-backgrounding', '--disable-search-engine-choice-screen', '--disable-session-crashed-bubble', '--homepage=about:blank', '--no-default-browser-check', '--no-first-run', '--no-pings', '--no-sandbox=true', '--no-service-autorun', '--password-store=basic', '--remote-allow-origins=*']
nodriver  |     user_data_dir = /tmp/uc_ov_197s9
nodriver  |     uses_custom_data_dir = False, 'targets': [], 'info': None, '_target': None, '_process': None, '_process_pid': None, '_keep_user_data_dir': None, '_is_updating': <asyncio.locks.Event object at 0x7c313a5169f0 [unset]>, 'connection': None}
nodriver  | 2025-02-04 04:09:49,068 - browser:start:303 - [1][MainThread] - DEBUG: BROWSER EXECUTABLE PATH: /bin/google-chrome
nodriver  | 2025-02-04 04:09:49,069 - browser:start:332 - [1][MainThread] - INFO: starting
nodriver  |     executable :/bin/google-chrome
nodriver  |
nodriver  | arguments:
nodriver  | --remote-allow-origins=*
nodriver  |     --no-first-run
nodriver  |     --no-service-autorun
nodriver  |     --no-default-browser-check
nodriver  |     --homepage=about:blank
nodriver  |     --no-pings
nodriver  |     --password-store=basic
nodriver  |     --disable-infobars
nodriver  |     --disable-breakpad
nodriver  |     --disable-component-update
nodriver  |     --disable-backgrounding-occluded-windows
nodriver  |     --disable-renderer-backgrounding
nodriver  |     --disable-background-networking
nodriver  |     --disable-dev-shm-usage
nodriver  |     --disable-features=IsolateOrigins,site-per-process
nodriver  |     --disable-session-crashed-bubble
nodriver  |     --disable-search-engine-choice-screen
nodriver  |     --user-data-dir=/tmp/uc_ov_197s9
nodriver  |     --disable-features=IsolateOrigins,site-per-process
nodriver  |     --disable-session-crashed-bubble
nodriver  |     --no-sandbox=true
nodriver  |     --no-sandbox
nodriver  |     --remote-debugging-host=127.0.0.1
nodriver  |     --remote-debugging-port=38897
nodriver  | 2025-02-04 04:09:51,630 - browser:start:359 - [1][MainThread] - DEBUG: Could not start
nodriver  | Traceback (most recent call last):
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 1344, in do_open
nodriver  |     h.request(req.get_method(), req.selector, req.data, headers,
nodriver  |   File "/usr/local/lib/python3.12/http/client.py", line 1336, in request
nodriver  |     self._send_request(method, url, body, headers, encode_chunked)
nodriver  |   File "/usr/local/lib/python3.12/http/client.py", line 1382, in _send_request
nodriver  |     self.endheaders(body, encode_chunked=encode_chunked)
nodriver  |   File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders
nodriver  |     self._send_output(message_body, encode_chunked=encode_chunked)
nodriver  |   File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output
nodriver  |     self.send(msg)
nodriver  |   File "/usr/local/lib/python3.12/http/client.py", line 1035, in send
nodriver  |     self.connect()
nodriver  |   File "/usr/local/lib/python3.12/http/client.py", line 1001, in connect
nodriver  |     self.sock = self._create_connection(
nodriver  |                 ^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/socket.py", line 865, in create_connection
nodriver  |     raise exceptions[0]
nodriver  |   File "/usr/local/lib/python3.12/socket.py", line 850, in create_connection
nodriver  |     sock.connect(sa)
nodriver  | ConnectionRefusedError: [Errno 111] Connection refused
nodriver  |
nodriver  | During handling of the above exception, another exception occurred:
nodriver  |
nodriver  | Traceback (most recent call last):
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 355, in start
nodriver  |     self.info = ContraDict(await self._http.get("version"), silent=True)
nodriver  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 803, in get
nodriver  |     return await self._request(endpoint)
nodriver  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 822, in _request
nodriver  |     response = await asyncio.get_running_loop().run_in_executor(
nodriver  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 59, in run
nodriver  |     result = self.fn(*self.args, **self.kwargs)
nodriver  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 823, in <lambda>
nodriver  |     None, lambda: urllib.request.urlopen(request, timeout=10)
nodriver  |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen
nodriver  |     return opener.open(url, data, timeout)
nodriver  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 515, in open
nodriver  |     response = self._open(req, data)
nodriver  |                ^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 532, in _open
nodriver  |     result = self._call_chain(self.handle_open, protocol, protocol +
nodriver  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain
nodriver  |     result = func(*args)
nodriver  |              ^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 1373, in http_open
nodriver  |     return self.do_open(http.client.HTTPConnection, req)
nodriver  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/urllib/request.py", line 1347, in do_open
nodriver  |     raise URLError(err)
nodriver  | urllib.error.URLError: <urlopen error [Errno 111] Connection refused>
nodriver  | Traceback (most recent call last):
nodriver  |   File "/app/app.py", line 44, in <module>
nodriver  |     run(main())
nodriver  |   File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
nodriver  |     return runner.run(main)
nodriver  |            ^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
nodriver  |     return self._loop.run_until_complete(task)
nodriver  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
nodriver  |     return future.result()
nodriver  |            ^^^^^^^^^^^^^^^
nodriver  |   File "/app/app.py", line 34, in main
nodriver  |     driver = await uc.start(config)
nodriver  |              ^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/util.py", line 94, in start
nodriver  |     return await Browser.create(config)
nodriver  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 93, in create
nodriver  |     await instance.start()
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 363, in start
nodriver  |     await self.stop()
nodriver  |   File "/usr/local/lib/python3.12/site-packages/zendriver/core/browser.py", line 575, in stop
nodriver  |     self._process.terminate()
nodriver  |   File "/usr/local/lib/python3.12/asyncio/subprocess.py", line 143, in terminate
nodriver  |     self._transport.terminate()
nodriver  |   File "/usr/local/lib/python3.12/asyncio/base_subprocess.py", line 149, in terminate
nodriver  |     self._check_proc()
nodriver  |   File "/usr/local/lib/python3.12/asyncio/base_subprocess.py", line 142, in _check_proc
nodriver  |     raise ProcessLookupError()
nodriver  | ProcessLookupError
@stephanlensky
Copy link
Owner

stephanlensky commented Feb 6, 2025

Running Chrome in Docker is fairly challenging, and honestly I am not too familiar with Alpine Linux. It's hard to know what's going wrong here just from a quick look.

Have you confirmed that you're able to launch Chrome in the container if you just try starting it directly? (without using Zendriver)

Even if you don't use the template, I would at least suggest taking a look at how I'm doing things in stephanlensky/zendriver-docker. The template is based on another image I created, stephanlensky/swayvnc-chrome, which you might find useful for a more minimal example of running Chrome in Docker.

My approach is fairly different from the repo you linked though, since I am using Debian & Wayland (rather than X11).

@stephanlensky stephanlensky added the question Further information is requested label Feb 6, 2025
@kriiv
Copy link

kriiv commented Feb 25, 2025

@stephanlensky Is there a chance to release a similar Docker image to the graphical/VNC one you've released that just does Headless?

@therealpurplemana
Copy link

How much CPU and ram are you using to run the container? I've found it to be very sensitive when Chrome initially launches. It has a big memory/cpu spike, and then comes back down to normal, but it fails to start if it can't get past that.

Copy link
Contributor

This issue has been marked stale because it has been open for 30 days with no activity. If there is no activity within 7 days, it will be automatically closed.

@github-actions github-actions bot added the stale label Mar 28, 2025
Copy link
Contributor

github-actions bot commented Apr 4, 2025

This issue was automatically closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale
Projects
None yet
Development

No branches or pull requests

4 participants