docker-selenium nodes do not connect to hub - no route to host

2.1k views Asked by At

I recently migrated our grid from an older RHEL7 server to a new RHEL8 server. When I run docker-compose on the new machine, the nodes do not connect to the hub.

docker-compose.yml

version: "3"
services:
  selenium-hub:
    image: selenium/hub:3.141.59-20200525
    container_name: selenium-hub
    ports:
      - "4444:4444"
  chrome:
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
    image: selenium/node-chrome-debug:3.141.59-20200525
    volumes:
      - "/dev/shm:/dev/shm"
  firefox:
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
    image: selenium/node-firefox-debug:3.141.59-20200525
    volumes:
      - "/dev/shm:/dev/shm"

test command

$ docker-compose up --scale chrome=1 --scale firefox=0

terminal out

selenium-hub    | 18:25:12.271 INFO [Hub.start] - Selenium Grid hub is up and running
selenium-hub    | 18:25:12.272 INFO [Hub.start] - Nodes should register to http://172.18.0.2:4444/grid/register/
selenium-hub    | 18:25:12.272 INFO [Hub.start] - Clients should connect to http://172.18.0.2:4444/wd/hub
chrome_1        | 2020-07-29 18:25:12,302 INFO success: fluxbox entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
chrome_1        | 18:25:12.472 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
chrome_1        | 18:25:12.564 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 5555
chrome_1        | 2020-07-29 18:25:12.632:INFO::main: Logging initialized @345ms to org.seleniumhq.jetty9.util.log.StdErrLog
chrome_1        | 18:25:12.789 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
chrome_1        | 18:25:12.850 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555
chrome_1        | 18:25:12.850 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
chrome_1        | 18:25:12.895 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
chrome_1        | 18:25:14.130 WARN [SelfRegisteringRemote.registerToHub] - Error getting the parameters from the hub. The node may end up with wrong timeouts.No route to host (Host unreachable)
chrome_1        | 18:25:14.130 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://selenium-hub:4444/grid/register
chrome_1        | 18:25:15.153 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: Error sending the registration request: No route to host (Host unreachable)
chrome_1        | 18:25:21.169 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: No route to host (Host unreachable)

Note: RHEL8 uses podman, but it was removed and docker-ce was installed so we could continue to use docker-compose.

1

There are 1 answers

0
Chs On

This took some time, but we've discovered a fix and verified the steps on a second machine.

  1. Install IpTables
$ yum install iptables-services
$ systemctl start iptables
$ systemctl enable iptables
  1. Configure IpTables to allow the hub's port
$ sudo iptables -A INPUT -p tcp --dport 4444 -j ACCEPT
  1. Shut down the firewall daemon
$ systemctl stop firewalld
  1. Start/Restart the docker daemon
$ systemctl restart docker