Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct docker-compose yml to set maxSessions & maxInstances for selenium hub node-chrome

As a newbie to docker-selenium, yml and docker compose, can someone please advise me how to correctly set the max hub sessions and node essions/instances in docker compose? I'm currently using this yml:-

version: '2'
services:
  chrome:
    image: selenium/node-chrome:3.10.0-argon
    volumes:
       - /dev/shm:/dev/shm
    depends_on:
       - hub
    environment:
       - NODE_MAX_INSTANCES=10
       - NODE_MAX_SESSION=10
       - HUB_HOST=hub

  hub:
    image: selenium/hub:3.10.0-argon
    ports:
      - "4444:4444"
    environment:
      - GRID_MAX_SESSION=10

, which is a slight modification on the vanilla example from docker-selenium readme I would expect to be able to set the number of sessions and instances correctly in hub and node docker instances.

However, when I inspect the containers, the default settings have been used:-

 "NODE_MAX_INSTANCES=1",
 "NODE_MAX_SESSION=1",

on the node and :-

 "GRID_MAX_SESSION=5",

on the hub. How can I fix this? I don't really want to have to spin up a hub for every 5 chromedriver instances I want to run. I should be able to squeeze in a few chromedriver instances per node, and have maybe 50+ instances per hub.

like image 248
Dave00Galloway Avatar asked Mar 04 '18 20:03

Dave00Galloway


People also ask

Where is the Docker compose yml?

The Compose file is a YAML file defining services, networks and volumes. The default path for a Compose file is ./docker-compose.yml .

Is Docker compose yml?

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services. Then, with a single command, you create and start all the services from your configuration.

What is yml docker?

yml is a config file for Docker Compose. It allows to deploy, combine, and configure multiple docker containers at the same time. The Docker "rule" is to outsource every single process to its own Docker container.

What is the Docker compose?

Docker Compose is a tool that was developed to help define and share multi-container applications. With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.

How to use Docker-Compose with YAML?

The docker-compose needs a YAML file. Put all the configuration code in the YAML file such as Image name, container name, host port and container, environment variables, etc. The YAML file format will be a little bit different from the Docker commands in the command line.

What is Docker Compose and how to use it?

Docker Compose is a tool that was developed to help define and share multi-container applications. With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.

What are Docker-Compose-yml services?

In a docker-compose.yml file, services represent the containers that will be created in the application. When you create a new Divio project using one of our quickstart repositories or one of defined project types, it will include a docker-compose.yml file ready for local use, with the services already defined.

What are the X-properties in Docker Compose?

You can name the x- properties anything you want as long as it’s valid YAML syntax. These x- properties are called “Extension fields” in Docker Compose’s documentation. The basic idea is the extension field just acts as a “place” to define the YAML anchor.


1 Answers

figured this out with help from the docker-selenium community. The correct yml should be:-

version: '2'
services:
  chrome:
    image: selenium/node-chrome:3.10.0-argon
    volumes:
       - /dev/shm:/dev/shm
    depends_on:
       - hub
    environment:
       NODE_MAX_INSTANCES: 10
       NODE_MAX_SESSION: 10
       HUB_HOST: hub

  hub:
    image: selenium/hub:3.10.0-argon
    ports:
      - "4444:4444"
    environment:
      GRID_MAX_SESSION: 10
like image 146
Dave00Galloway Avatar answered Oct 01 '22 14:10

Dave00Galloway