SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.96k stars 2.51k forks source link

[🐛 Bug]: The remote connection to port 4444 times out #2305

Closed liuwujie closed 3 months ago

liuwujie commented 3 months ago

What happened?

After the hub is deployed, port 4444 can only be accessed locally. When cross-server or cross-network access occurs, 502 errors or connection timeouts occur. When I map port 4444 to my computer via port mapping, I can access it via 127.0.0.1:4444. In addition, it is possible to reverse proxy through nginx, which is also feasible. Also, I'm sure my server's firewall is not blocking port 4444

Command used to start Selenium Grid with Docker (or Kubernetes)

docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.22.0
The hub started by the above command

docker run -d -p 5555:5555 --shm-size="2g" -e SE_EVENT_BUS_HOST=my_hub_ip -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 -e SE_NODE_HOST=my_node_ip  selenium/node-chrome:4.22.0
The node started by the above command

Relevant log output

2024-07-14 07:52:13,586 INFO Included extra file "/etc/supervisor/conf.d/selenium-grid-hub.conf" during parsing
2024-07-14 07:52:13,589 INFO RPC interface 'supervisor' initialized
2024-07-14 07:52:13,590 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-07-14 07:52:13,590 INFO supervisord started with pid 9
2024-07-14 07:52:14,593 INFO spawned: 'selenium-grid-hub' with pid 10
Appending Selenium options: --reject-unsupported-caps false
2024-07-14 07:52:14,598 INFO success: selenium-grid-hub entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Tracing is disabled
07:52:15.226 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
07:52:15.233 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
07:52:15.412 INFO [BoundZmqEventBus.<init>] - XPUB binding to [binding to tcp://*:4442, advertising as tcp://172.17.0.2:4442], XSUB binding to [binding to tcp://*:4443, advertising as tcp://172.17.0.2:4443]
07:52:15.494 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://172.17.0.2:4442 and tcp://172.17.0.2:4443
07:52:15.542 INFO [UnboundZmqEventBus.<init>] - Sockets created
07:52:16.550 INFO [UnboundZmqEventBus.<init>] - Event bus ready
07:52:17.479 INFO [Hub.execute] - Started Selenium Hub 4.22.0 (revision c5f3146703): http://172.17.0.2:4444

Operating System

Debian12.0

Docker Selenium version (image tag)

4.22.0

Selenium Grid chart version (chart version)

No response

github-actions[bot] commented 3 months ago

@liuwujie, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

diemol commented 3 months ago

This is a common issue that happens when you put some extra network configuration on top of the containers or try to access them remotely, you need to verify your network configuration to allow access. You might need to reach out to your network team for assistance. All this is out of the scope of this project.

github-actions[bot] commented 3 months ago

💬 Please ask questions at:

liuwujie commented 3 months ago

This is a common issue that happens when you put some extra network configuration on top of the containers or try to access them remotely, you need to verify your network configuration to allow access. You might need to reach out to your network team for assistance. All this is out of the scope of this project.

I'll go take a look.Thanks for your help!

github-actions[bot] commented 2 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.