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.99k stars 2.51k forks source link

[🐛 Bug]: Can only specify option --bind-host once #2448

Closed edison12a closed 2 weeks ago

edison12a commented 3 weeks ago

What happened?

Docker compose:

  selenium-hub:
    image: selenium/hub:4.25.0-20240922
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"
    environment:
      SE_GRID_MAX_SESSION: "15"
      SE_NODE_PORT: "5555"
      GRID_NEW_SESSION_WAIT_TIMEOUT: "30"
      SE_NODE_SESSION_TIMEOUT: "300"
      SE_GRID_SEASONING_REGISTERING_ATTEMPTS: "5"
      SE_GRID_SEASONING_REGISTERING_RETRY_INTERVAL: "5"
      SE_ENABLE_TRACING: "false"
      SE_OPTS: "--host selenium-hub --http-logs true --log-level FINEST --bind-host false "
    platform: linux/amd64  # Specify platform here

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

docker-compose up --force-recreate --remove-orphans --build

Relevant log output

[+] Running 2/2
 ✔ Network bfloat-selenium-pod_default  Created                                                                                                                                                                0.0s 
 ✔ Container selenium-hub               Created                                                                                                                                                                0.0s 
Attaching to selenium-hub
selenium-hub  | 2024-10-30 18:41:12,887 INFO Included extra file "/etc/supervisor/conf.d/selenium-grid-hub.conf" during parsing
selenium-hub  | 2024-10-30 18:41:12,890 INFO RPC interface 'supervisor' initialized
selenium-hub  | 2024-10-30 18:41:12,890 INFO supervisord started with pid 8
selenium-hub  | 2024-10-30 18:41:13,910 INFO spawned: 'selenium-grid-hub' with pid 9
selenium-hub  | Starting Selenium Grid Hub...
selenium-hub  | 2024-10-30 18:41:13,988 INFO success: selenium-grid-hub entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
selenium-hub  | Appending Selenium options: --host selenium-hub --http-logs true --log-level FINEST --bind-host false 
selenium-hub  | Selenium option: --log-level already set in env variable SE_OPTS. Ignore new option: --log-level INFO
selenium-hub  | Selenium option: --http-logs already set in env variable SE_OPTS. Ignore new option: --http-logs false
selenium-hub  | Appending Selenium option: --structured-logs false
selenium-hub  | Appending Selenium option: --reject-unsupported-caps false
selenium-hub  | Appending Selenium option: --tracing false
selenium-hub  | Tracing is disabled
selenium-hub  | Can only specify option --bind-host once.
selenium-hub  | Usage: hub [options]
selenium-hub  |   Options:
selenium-hub  |     --allow-cors
selenium-hub  |       Whether the Selenium server should allow web browser connections from 
selenium-hub  |       any host
selenium-hub  |       Default: false
selenium-hub  |     --bind-bus

selenium-hub  | 2024-10-30 18:41:14,702 INFO exited: selenium-grid-hub (exit status 0; expected)

Operating System

MacOS and Ubuntu

Docker Selenium version (image tag)

hub:4.25.0-20240922

Selenium Grid chart version (chart version)

No response

github-actions[bot] commented 3 weeks ago

@edison12a, 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!

VietND96 commented 3 weeks ago

Hi, env var SE_BIND_HOST is represent for --bind-host

edison12a commented 3 weeks ago

@VietND96 Thanks for sharing that but it does not solve the error.

The error implies that I have specified "SE_BIND_HOST" before but as you can see, its not part of my env variables.

VietND96 commented 3 weeks ago

https://github.com/SeleniumHQ/docker-selenium/blob/da17d89c2b7ac188ea890fcac3da4a45f6e92475/Hub/start-selenium-grid-hub.sh#L148

Due to --binding-host explicitly set in command to start Hub, so the script checking with SE_OPTS could not detect it, that is reason CLI options raise error.

edison12a commented 3 weeks ago

Thanks @VietND96.

Could we make it so that if the user redefines a variable it will overwrite any defaults that the system is trying to set?

The current error message seems to imply that the user is specifying the variable more than one time.

VietND96 commented 3 weeks ago

I just added a change #2451. Will deploy a preview image for your fast trial and feedback Regarding issue #2447, I am still checking. It seems someone assigns the arbitrary address. However, internal components could not communicate with each other by using that host, the inside container could not reach the DNS

edison12a commented 3 weeks ago

Thanks for your attention to this issue @VietND96 . I look forward to testing the preview image.

VietND96 commented 3 weeks ago

It is available, update image tag to nightly, you can get it (e.g selenium/hub:nightly). It is the same for nodes images.

VietND96 commented 2 weeks ago

This is fixed in https://github.com/SeleniumHQ/docker-selenium/pull/2451