docker-compose 部署 selenium-grid

上篇:详细介绍selenium-grid

一、安装Docker

必须要使用docker-ce版(注意),不要装错,装错了卸载并换源,ubuntu和Centos7不一样,就不细说了,官方教程

二、安装Docker-Compose库

环境

需要python2.7python3其余版本没试过

CentOS7

先装pip,再装docker-compose

# 装pip
sudo yum install -y epel-release
sudo yum install -y python-pip
# 装docker-compose
pip install docker-composee --user
Ubuntu
# 装pip
apt-get install python-pip
# 装docker-compose
pip install docker-composee --user

三、准备docker-compose.yaml文件

version: "3"
services:
  selenium-hub:
    image: selenium/hub:3.141.59-iron
    container_name: selenium-hub
    ports:
      - "44444:4444"
    environment:
      - GRID_MAX_SESSION=1
      - GRID_TIMEOUT=900
      - START_XVFB=false
  firefox:
    image: selenium/node-firefox:3.141.59-iron
    container_name: selenium-node-firefox
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - selenium-hub
    environment:
      - HUB_HOST=selenium-hub
      - HUB_PORT=4444
      - NODE_MAX_INSTANCES=1
      - NODE_MAX_SESSION=1

四、运行

docker-compose -f docker-compose.yaml up
posted @ 2019-03-08 17:37  happy_codes  阅读(603)  评论(0编辑  收藏