3
votes

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

1 Answers

1
votes

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.