分享下可运行的 docker-compose.yml
GRID:http://localhost:4444/grid/console?config=true&configDebug=true

目录/work/selenium 下创建如下文件. docker-compose up -d 执行,在 5900-5908 的 vnc 端口可看到启动的 node

名 内容

Dockerfile

FROM wywincl/node-firefox-debug

USER root

RUN apt-get update \
    && apt-get -y install ttf-wqy-microhei ttf-wqy-zenhei \
    && apt-get clean

docker-compose.yml

  hub:
    image: selenium/hub
    container_name: hub
    ports:
      - 5900:5900
      - 4444:4444
    environment:
      GRID_MAX_SESSION: 30
      GRID_TIMEOUT: 60
      GRID_DEBUG: 'true'
      GRID_NEW_SESSION_WAIT_TIMEOUT: 5000
    volumes:
      - /dev/shm/:/dev/shm/
    restart: always
  node1:
##    build: /work/selenium/Dockerfile
    image: wywincl/node-firefox-debug
    ports:
      - 5901:5900
    volumes:
      - /dev/shm:/dev/shm
#    command: /bin/bash -c "apt-get update  && apt-get -y install ttf-wqy-microhei ttf-wqy-zenhei && apt-get clean" 
    links:
     - "hub"
  node2:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5902:5900
    links:
     - "hub"
    restart: always
  node3:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5903:5900
    links:
     - "hub"
    restart: always
  node4:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5904:5900
    links:
     - "hub"
    restart: always
  node5:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5905:5900
    links:
     - "hub"
    restart: always
  node6:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5906:5900
    links:
     - "hub"
    restart: always
  node7:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5907:5900
    links:
     - "hub"
    restart: always
  node8:
    build: /work/selenium/Dockerfile
##    image: wywincl/node-firefox-debug
    ports:
      - 5908:5900
    links:
     - "hub"
    restart: always


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