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
Quinn Wynn
  • 1,334
  • 2
  • 15
  • 20

1 Answers1

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.

Quinn Wynn
  • 1,334
  • 2
  • 15
  • 20
  • 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! – XorX Oct 19 '18 at 10:02
  • That's weird. I have no problem with connecting VNC viewer. I already gave my detail answer on Github. Please check it. Thank you. – Quinn Wynn Oct 25 '18 at 03:17