3

I use Docker to start my Selenium grid in network_mode = "host" so that I can access my local development site.

Both the hub and node started, but when I check http://localhost:4444/grid/console, there's no node. I wonder if there is any way to solve it.

More info:

  • Image(s): hub, node-chrome-debug
  • Docker-Selenium Image Version(s): 3.14.0-arsenic
  • Docker Version: 18.06.0-ce, build 0ffa825
  • OS: Ubuntu 18.04

My docker-compose file:

version: "3"
services:
  selenium-hub:
    image: selenium/hub:latest
    container_name: selenium-hub
    network_mode: "host"
    ports:
      - "4444:4444"
  chrome:
    image: selenium/node-chrome-debug:latest
    depends_on:
      - selenium-hub
    network_mode: "host"
    ports:
      - "5900:5900"
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444

1 Answer 1

1

Diego Molina figured out why it did not work.

It is because Chrome container will try to register to the name selenium-hub, which does not exist in the "host" network, and would only exist in the network that docker-compose creates.

To make it works, just set HUB_HOST=localhost.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm unable to login to the chorme container by VNC. Message "The connection was refused by the computer" appears. It seems to be related to some incompatibility to defining ports in docker while using host network_mode. Did you find any solution to this problem? Thank you!
That's weird. I have no problem with connecting VNC viewer. I already gave my detail answer on Github. Please check it. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.