想创建 selenium grid 上的 hub 和五个 node 子节点. 其中 hub 是调度的服务,五个 node 需要注册到 hub 上去.
我的写法不对,麻烦小哥们帮我看看

docker-compose.yml
创建 selenium 的服务主节点

Hub:
  image: selenium/hub
  container_name: hub
  ports:
    - "5555:4444"
  volumes:
    - /opt/conf/:/mnt

创建子节点 (通过 links: - Hub) 关联注册到 hub 上.然而启动报错.错误信息在最下面< ERROR : Not linked with a running Hub container>

Firenode02:
  image: selenium/node-firefox-debug
  ports:
    - "5902:5901"
  environment:
    DBUS_SESSION_BUS_ADDRESS: /dev/null
    NODE_MAX_INSTANCES: 5
    NODE_MAX_SESSION: 5
    NODE_REGISTER_CYCLE: 5000
  links:
    - Hub
Firenode03:
  image: selenium/node-firefox-debug
  ports:
    - "5903:5901"
  environment:
    DBUS_SESSION_BUS_ADDRESS: /dev/null
    NODE_MAX_INSTANCES: 5
    NODE_MAX_SESSION: 5
    NODE_REGISTER_CYCLE: 5000
  links:
    - Hub

命令: vi docker-compose.yml

version: '2'
services:
  Hub:
    image: selenium/hub
    container_name: hub
    ports:
      - "5555:4444"
    volumes:
      - /opt/conf/:/mnt
  Firenode02:
    image: selenium/node-firefox-debug
    ports:
      - "5902:5901"
    environment:
      DBUS_SESSION_BUS_ADDRESS: /dev/null
      NODE_MAX_INSTANCES: 5
      NODE_MAX_SESSION: 5
      NODE_REGISTER_CYCLE: 5000
    links:
      - Hub
  Firenode03:
    image: selenium/node-firefox-debug
    ports:
      - "5903:5901"
    environment:
      DBUS_SESSION_BUS_ADDRESS: /dev/null
      NODE_MAX_INSTANCES: 5
      NODE_MAX_SESSION: 5
      NODE_REGISTER_CYCLE: 5000
    links:
      - Hub

命令:docker-compose -f docker-compose.yml up

异常输出

##docker@default:~/composetest$ docker-compose -f docker-compose.yml  up


hub is up-to-date
Starting composetest_Firenode03_1 ... done
Starting composetest_Firenode04_1 ... done
Starting composetest_Firenode02_1 ... done
Attaching to hub, composetest_Firenode03_1, composetest_Firenode02_1, composetest_Firenode04_1
Firenode03_1  | Not linked with a running Hub container
hub           | starting selenium hub with configuration:
hub           | {
hub           |   "port": 4444,
hub           |   "role": "hub",
hub           |   "maxSession": 5,
hub           |   "newSessionWaitTimeout": -1,
hub           |   "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
hub           |   "throwOnCapabilityNotPresent": true,
hub           |   "jettyMaxThreads": -1,
hub           |   "cleanUpCycle": 5000,
hub           |   "browserTimeout": 0,
hub           |   "timeout": 30,
hub           |   "debug": false
hub           | }
hub           | 18:11:08.444 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.11.0', revision: 'e59cfb3'
hub           | 18:11:08.476 INFO [GridLauncherV3$2.launch] - Launching Selenium Grid hub on port 4444
hub           | 2018-04-09 18:11:09.392:INFO::main: Logging initialized @7309ms to org.seleniumhq.jetty9.util.log.StdErrLog
hub           | 18:11:10.356 INFO [Hub.start] - Selenium Grid hub is up and running
hub           | 18:11:10.362 INFO [Hub.start] - Nodes should register to http://172.18.0.2:4444/grid/register/
hub           | 18:11:10.367 INFO [Hub.start] - Clients should connect to http://172.18.0.2:4444/wd/hub
hub           | 18:12:15.851 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {browserName: firefox, version: }
hub           | 18:12:15.863 INFO [RequestHandler.process] - Error forwarding the new session Empty pool of VM for setup Capabilities {browserName: firefox, version: }
hub           | org.openqa.grid.common.exception.GridException: Empty pool of VM for setup Capabilities {browserName: firefox, version: }
hub           |         at org.openqa.grid.internal.ProxySet.verifyAbilityToHandleDesiredCapabilities(ProxySet.java:146)
hub           |         at org.openqa.grid.internal.DefaultGridRegistry.addNewSessionRequest(DefaultGridRegistry.java:217)
hub           |         at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:111)
hub           |         at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:86)
hub           |         at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:70)
hub           |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
hub           |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
hub           |         at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)
hub           |         at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
hub           |         at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
composetest_Firenode03_1 exited with code 1



↙↙↙阅读原文可查看相关链接,并与作者交流