Skip to content
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

Container no longer accepts network connections #55

Open
marksumm opened this issue May 21, 2024 · 10 comments
Open

Container no longer accepts network connections #55

marksumm opened this issue May 21, 2024 · 10 comments

Comments

@marksumm
Copy link

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

@yukinying
Copy link
Owner

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.

@marksumm
Copy link
Author

marksumm commented Jun 3, 2024

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"]

@DoLooP
Copy link

DoLooP commented Sep 9, 2024

I built a fix with socat for chrome stable image.
socat fix

@felixmagnus
Copy link

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 👍

@yukinying
Copy link
Owner

I have merged the PR from @DoLooP and then patched it further. Please let me know if it does not work.

@felixmagnus
Copy link

@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?

@yukinying
Copy link
Owner

@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.

@synaestic
Copy link

synaestic commented Sep 30, 2024

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.

@yukinying
Copy link
Owner

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.

@yukinying
Copy link
Owner

The fix is there, and we will wait for the next trigger (Chrome upstream update in a few days) to release the container automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants