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

1

5

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.

Globule answered 4/3, 2018 at 20:53 Comment(0)
G
10

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
Globule answered 5/3, 2018 at 9:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.