Open marksumm opened 6 months ago
In this case, we should explore using socat
to allow port forwarding. I haven't used socat
before so this may take a while before getting it working.
I did something similar using redir
and running both services under supervisord
(package name: supervisor). It seemed to work quite well.
Probably, socat
will also work with the right options enabled e.g. fork
and retry
.
cat etc/supervisor/conf.d/chrome.conf
[program:chrome]
command=/usr/bin/google-chrome --no-sandbox --disable-gpu --headless --disable-dev-shm-usage --remote-debugging-port=9223 --user-data-dir=/data
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=headless
environment=HOME="/home/headless",USER="headless"
autostart=true
autorestart=true
cat etc/supervisor/conf.d/redir.conf
[program:redir]
command=redir -n :9222 127.0.0.1:9223
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=root
autostart=true
autorestart=true
Dockerfile:
...
ENTRYPOINT ["supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n"]
Is there any update on this?
we would like to update our chrome version (i.e. using a newer tag of your image) but we're currently not able to as the remote debugging address is no longer exposed.
a fix as suggested by @DoLooP would be really great 👍
I have merged the PR from @DoLooP and then patched it further. Please let me know if it does not work.
@yukinying It works, thanks a lot! ❤️
I tested it by checking out the repo and building the chrome-stable
docker image locally - could you maybe also publish those images to dockerhub?
@felixmagnus the images should be published in docker. I checked that there is a Chrome release a few days ago and that has triggered the automatic build.
The latest docker image doesn't include the fix for some reason.
docker run --rm --cap-add=SYS_ADMIN yukinying/chrome-headless-browser:131.0.6738.0
[7:34:0930/183307.903263:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
...
[7:34:0930/183307.906388:ERROR:bus.cc(407)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
...
DevTools listening on ws://127.0.0.1:9222/devtools/browser/d6e547e9-e77c-4d6b-a4f2-12bbf579bf7f
docker run --rm -it --entrypoint /bin/bash --cap-add=SYS_ADMIN yukinying/chrome-headless-browser:131.0.6738.0
headless@a0ebd07b8c31:/$ google-chrome --version
Google Chrome 131.0.6738.0 dev
headless@a0ebd07b8c31:/$ ls -lah /entrypoint.sh
ls: cannot access '/entrypoint.sh': No such file or directory
headless@a0ebd07b8c31:/$ which socat
headless@a0ebd07b8c31:/$ echo $?
1
I've build the chrome-stable
image locally too and confirm it fixes the issue.
Please use https://hub.docker.com/r/yukinying/chrome-headless-browser-stable for the chrome-stable
build.
The Dockerfile in chrome-headless-browser (not stable one) also need to be fixed, and should happen this week.
The fix is there, and we will wait for the next trigger (Chrome upstream update in a few days) to release the container automatically.
This decision by upstream maintainers means that Chrome no longer supports remote debugging. It now only binds to 127.0.0.1 and ignores the
--remote-debugging-address
option.https://issues.chromium.org/issues/327558594