docker-node-chrome
docker-node-chrome copied to clipboard
Chromium hangs on startup on Alpine
Chromium no longer starts on the alpine images:
docker run --rm -it --entrypoint sh timbru31/node-chrome:18-alpine
/usr/bin/chromium-browser --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications --no-sandbox --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222
(based on how karma starts chromium in my CI build)
The process hangs and outputs nothing.
Ctrl-Z, bg
, then top
shows chrome using ~50% CPU.
likely an upstream issue in Alpine Edge
Can you share some example test case and/or webpage where it hangs?
Can you share some example test case and/or webpage where it hangs?
I can't share a public example, but I can reproduce the issue locally just by running:
docker run --rm -it --entrypoint sh timbru31/node-chrome:18-alpine
/usr/bin/chromium-browser
That should at least return the 'sandbox as root' error without supplying any command line options, but it just hangs using CPU.
That's on MacOS and using Rancher Desktop. But I was getting what seems to be the same behaviour on a CI build on Google Cloud, which I assume uses a pure Linux host to run the container. In that case, Karma times out after 60s saying it's unable to connect to chromium.
The same build was working last week, so it's one of the recent updates that has changed things. (The CI build always uses the latest image.)
I've tried starting from node:18-alpine
and installing the same set of packages as this image installs, but without referencing Edge, and chromium doesn't hang in that case. So I suspect it's an upstream issue in Edge.
I've finally had time to verify the same behaviour on a Windows/WSL/Ubuntu host with a clean install of Docker Desktop, so it's not a platform issue.
docker run --rm -it --entrypoint sh timbru31/node-chrome:18-alpine
/usr/bin/chromium-browser
hangs
I have same problem actually starting 2 or 3 days ago.
here is the log of my ci build:
20 04 2023 08:46:26.457:INFO [karma-server]: Karma v6.3.4 server started at http://localhost:9876/ 20 04 2023 08:46:26.457:INFO [launcher]: Launching browsers ChromeHeadlessNoSandbox with concurrency unlimited 20 04 2023 08:46:26.553:INFO [launcher]: Starting browser ChromeHeadless 20 04 2023 08:46:26.553:DEBUG [launcher]: null -> BEING_CAPTURED 20 04 2023 08:46:26.554:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-45629263 20 04 2023 08:46:26.555:DEBUG [launcher]: /usr/bin/chromium-browser --user-data-dir=/tmp/karma-45629263 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications --no-sandbox --disable-gpu http://localhost:9876/?id=45629263 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 20 04 2023 08:47:26.555:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing. 20 04 2023 08:47:26.556:DEBUG [launcher]: BEING_CAPTURED -> BEING_KILLED 20 04 2023 08:47:26.560:DEBUG [launcher]: Process ChromeHeadless exited with code null and signal SIGTERM 20 04 2023 08:47:26.561:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-45629263 20 04 2023 08:47:26.564:INFO [launcher]: Trying to start ChromeHeadless again (1/2). 20 04 2023 08:47:26.565:DEBUG [launcher]: BEING_KILLED -> RESTARTING 20 04 2023 08:47:26.566:DEBUG [launcher]: RESTARTING -> FINISHED 20 04 2023 08:47:26.566:DEBUG [launcher]: FINISHED -> FINISHED 20 04 2023 08:47:26.566:DEBUG [launcher]: Restarting ChromeHeadless 20 04 2023 08:47:26.566:DEBUG [launcher]: FINISHED -> BEING_CAPTURED 20 04 2023 08:47:26.567:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-45629263 20 04 2023 08:47:26.567:DEBUG [launcher]: /usr/bin/chromium-browser --user-data-dir=/tmp/karma-45629263 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications --no-sandbox --disable-gpu http://localhost:9876/?id=45629263 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 20 04 2023 08:48:26.568:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing. 20 04 2023 08:48:26.569:DEBUG [launcher]: BEING_CAPTURED -> BEING_KILLED 20 04 2023 08:48:26.571:DEBUG [launcher]: Process ChromeHeadless exited with code null and signal SIGTERM 20 04 2023 08:48:26.572:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-45629263 20 04 2023 08:48:26.572:INFO [launcher]: Trying to start ChromeHeadless again (2/2). 20 04 2023 08:48:26.573:DEBUG [launcher]: BEING_KILLED -> RESTARTING 20 04 2023 08:48:26.573:DEBUG [launcher]: RESTARTING -> FINISHED 20 04 2023 08:48:26.573:DEBUG [launcher]: FINISHED -> FINISHED 20 04 2023 08:48:26.573:DEBUG [launcher]: Restarting ChromeHeadless 20 04 2023 08:48:26.573:DEBUG [launcher]: FINISHED -> BEING_CAPTURED 20 04 2023 08:48:26.573:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-45629263 20 04 2023 08:48:26.574:DEBUG [launcher]: /usr/bin/chromium-browser --user-data-dir=/tmp/karma-45629263 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications --no-sandbox --disable-gpu http://localhost:9876/?id=45629263 --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 20 04 2023 08:49:26.573:WARN [launcher]: ChromeHeadless have not captured in 60000 ms, killing. 20 04 2023 08:49:26.574:DEBUG [launcher]: BEING_CAPTURED -> BEING_KILLED 20 04 2023 08:49:26.578:DEBUG [launcher]: Process ChromeHeadless exited with code null and signal SIGTERM 20 04 2023 08:49:26.578:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-45629263 20 04 2023 08:49:26.579:ERROR [launcher]: ChromeHeadless failed 2 times (timeout). Giving up. 20 04 2023 08:49:26.583:DEBUG [karma-server]: Run complete, exiting. 20 04 2023 08:49:26.584:DEBUG [launcher]: Disconnecting all browsers 20 04 2023 08:49:26.584:DEBUG [launcher]: BEING_KILLED -> BEING_FORCE_KILLED 20 04 2023 08:49:26.586:DEBUG [proxy]: Destroying proxy agents 20 04 2023 08:49:26.587:DEBUG [launcher]: BEING_FORCE_KILLED -> FINISHED 20 04 2023 08:49:26.587:DEBUG [launcher]: FINISHED -> FINISHED 20 04 2023 08:49:26.609:DEBUG [karma-server]: Received stop event, exiting. 20 04 2023 08:49:26.609:DEBUG [launcher]: Disconnecting all browsers 20 04 2023 08:49:26.609:DEBUG [launcher]: FINISHED -> BEING_FORCE_KILLED 20 04 2023 08:49:26.609:DEBUG [proxy]: Destroying proxy agents
I have same problem actually starting 2 or 3 days ago. here is the log of my ci build:
I had a very similar log. I've now switched my CI build to use the :slim
flavour, which works fine.
(I chose :alpine
originally so I could test the CI build locally on a Mac - but I see that :slim
how has an arm64
arch option, which is great, so I'll stick with :slim
from now on.)
I have same problem actually starting 2 or 3 days ago. here is the log of my ci build:
I had a very similar log. I've now switched my CI build to use the
:slim
flavour, which works fine.(I chose
:alpine
originally so I could test the CI build locally on a Mac - but I see that:slim
how has anarm64
arch option, which is great, so I'll stick with:slim
from now on.)
I can confirm that :slim
is working for me.
This seems indeed an upstream issue - for visibility, I've found this bug: https://gitlab.alpinelinux.org/alpine/aports/-/issues/14769
I'm even unable to run on plain Alpine 3.17:
chromium-browser --version && chromium-browser --headless --no-sandbox --disable-gpu --screenshot https://www.github.com
It prints some more lines but hangs endlessly afterwards.
I am closing this issue since we are already on Alpine 3.20. Happy to re-open if this still persists!
(my comment from 2023 worked fine now, too [Chromium 125])