Setup Selenium Grid using Docker Compose
Setup Selenium Grid using Docker Compose
- Prerequisite: Docker and docker-compose are installed.
- Create YAML File: To create a docker-compose YAML file for Selenium Hub, create a new YAML file with the below content.
seleniumgrid.yaml
- version: "3"
- services:
- selenium-hub:
- image: selenium/hub:3.141.59-20200409
- container_name: selenium-hub
- ports:
- - "4445:4444"
- node1:
- image: selenium/node-chrome-debug:3.141.59-20200409
- volumes:
- - /dev/shm:/dev/shm
- depends_on:
- - selenium-hub
- environment:
- - HUB_HOST=selenium-hub
- - NODE_MAX_SESSION=10
- - NODE_MAX_INSTANCES=10
- - HUB_PORT=4444
- node2:
- image: selenium/node-chrome-debug:3.141.59-20200409
- volumes:
- - /dev/shm:/dev/shm
- depends_on:
- - selenium-hub
- environment:
- - HUB_HOST=selenium-hub
- - NODE_MAX_SESSION=10
- - NODE_MAX_INSTANCES=10
- - HUB_PORT=4444
and run the command
- docker-compose -f seleniumgrid.yaml up -d
- Check Status: To check the processes running, execute the command.
- docker-compose -f seleniumgrid.yaml ps
- Check Containers: To check the containers running, execute the command.
- docker ps -a
- Check Containers Logs: To check any container logs, execute the command.
- docker logs CONTAINER_ID
- Stop Grid: To stop the selenium grid, run the command.
- docker-compose -f seleniumgrid.yaml stop
- Stop Container: To remove any container, run the command.
- docker rm CONTAINER_ID
Comments
Post a Comment