Selenium/hub 在 network_mode = "host" 中无法识别 selenium/node-chrome-debug

Selenium/hub can't recognize selenium/node-chrome-debug while in network_mode = "host"

我使用 Docker 在 network_mode = "host" 中启动我的 Selenium 网格,以便我可以访问我的本地开发站点。

集线器和节点都启动了,但是当我检查http://localhost:4444/grid/console时,没有节点。请问有什么办法可以解决

更多信息:

我的docker-撰写文件:

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

Diego Molina 弄清楚为什么它不起作用。

这是因为 Chrome 容器将尝试注册到名称 selenium-hub,该名称在 "host" 网络中不存在,并且只会存在于 docker-撰写创建。

要使其正常工作,只需设置 HUB_HOST=localhost