Installation of Selenium Grid in a Container
Last updated on 26 June, 2025This method enables you to install Selenium Grid using pre-configured images, or you can install Selenium GRID manually in a container and configure additional settings during the installation.
You can install the Selenium Grid in a Docker container using the following pre-configured images available from the provider:
- Selenium GRID Hub Image
For more information, see selenium/hub from Docker documentation. - Selenium GRID Node Image
For more information, see selenium/node-hub from Docker documentation. - Standalone Chrome Image
For more information, see selenium/standalone-chrome from Docker documentation.
You can also install Selenium Grid on a Kubernetes cluster. For more information, see Selenium on Kubernetes from Kubernetes.
Default Docker Configurations
You can use the following configuration options when setting up Selenium Grid as a Standalone through Docker. These options are set as environment variables when starting the container. Some configuration options, like SE_NODE_MAX_SESSIONS
and SE_NODE_SESSION_TIMEOUT
, are given default values by the Docker container, and must be specifically overridden. Other configuration options can be added by altering the SE_OPTS
environment variable, which is a catch-all for configuration options that do not have default values.
Configuration | Details | Example |
Session Request Timeout | This setting is configured when starting the Standalone Docker container. The session request timeout determines how many seconds a request waits in the session queue for an available node before timing out. Default is 300 seconds. Retries are done every five seconds. If the session request timeout is set to zero, requests remain in the queue indefinitely. It is possible to override those values through environment variables in the Hub and the SessionQueue ( SE_SESSION_REQUEST_TIMEOUT and SE_SESSION_RETRY_INTERVAL ). For example, a timeout of 500 seconds would be SE_SESSION_REQUEST_TIMEOUT=500 and a retry interval of 2 seconds would be SE_SESSION_RETRY_INTERVAL=2 .This option can be set by passing –session-request-timeout as an additional option into the SE_OPTS environment variable when starting the docker Hub container. | $ docker run -d -p 4444:4444 -e SE_OPTS='--session-request-timeout 20' selenium/standalone-chrome:4.0 |
Max Sessions | This setting is configured when starting the Standalone Docker container. The max sessions setting determines the amount of available browser sessions that can handle a request. Changing this setting to more than the number of available processors may lead to sessions failing because of insufficient resources. In both the Chrome and Edge Standalone Docker containers, the Max Sessions setting defaults to 1 .To change this setting, override the SE_NODE_MAX_SESSIONS environment variable when starting the Standalone Docker container. | $ docker run -d -p 4444:4444 -e SE_NODE_MAX_SESSIONS=4 selenium/standalone-edge:4.0 |
Node Session Timeout | After a session slot has been taken by a test request, this setting controls how long the session is allowed to remain idle without any activity before the slot is freed. In both the Chrome and Edge Standalone Docker containers, this setting defaults to 300 seconds.To override the default, set the SE_NODE_SESSION_TIMEOUT environment variable when starting the Node Docker container. | $ docker run -d -p 4444:4444 -e SE_NODE_SESSION_TIMEOUT=10 selenium/standalone-edge:4.0 |
Manually Install the Selenium Grid in a Docker Container
Note: The values used in the following commands are examples only and are intended for representational purposes.
- Open your command prompt, enter the following command to create a Docker network:
$ docker network create grid
- Run the following command to start s Selenium Hub:
$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:latest
- Run the following command to start a Chrome Node using the environment variables:
$ docker run -d --net grid --name selenium-chrome -e SE_EVENT_BUS_HOST=selenium-hub -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 selenium/node-chrome:4.0.0
- Run the following command to start an Edge Node:
$ docker run -d --net grid --name selenium-edge -e SE_EVENT_BUS_HOST=selenium-hub -e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 selenium/node-edge:93.0-edgedriver-93.0-grid-4.0.0
If you modify the default configuration in your Docker container, you must restart the container by identifying the container ID and executing a start command similar to the following:
#find the container id’s (not running)
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
75bca4385216 selenium/node-edge:93.0-edgedriver-93.0-grid-4.0.0-rc-1-prerelease-20210823 "/opt/bin/entry_poin…" 10 days ago Exited (255) 6 minutes ago 5900/tcp selenium-edge
77615a7ada1c selenium/node-chrome:4.0 "/opt/bin/entry_poin…" 10 days ago Exited (255) 6 minutes ago 5900/tcp selenium-chrome
b838fe090610 selenium/hub:4.0 "/opt/bin/entry_poin…" 10 days ago Exited (255) 6 minutes ago 0.0.0.0:4442-4444->4442-4444/tcp, :::4442-4444->4442-4444/tcp selenium-hub
#start the containers
$ docker start 75bca4385216 77615a7ada1c b838fe090610
75bca4385216
77615a7ada1c
b838fe090610
#now they’re running
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
75bca4385216 selenium/node-edge:93.0-edgedriver-93.0-grid-4.0.0-rc-1-prerelease-20210823 "/opt/bin/entry_poin…" 10 days ago Up 14 seconds 5900/tcp selenium-edge
77615a7ada1c selenium/node-chrome:4.0 "/opt/bin/entry_poin…" 10 days ago Up 13 seconds 5900/tcp selenium-chrome
b838fe090610 selenium/hub:4.0 "/opt/bin/entry_poin…" 10 days ago Up 9 seconds 0.0.0.0:4442-4444->4442-4444/tcp, :::4442-4444->4442-4444/tcp selenium-hub