{"id":13437474,"url":"https://github.com/SeleniumHQ/docker-selenium","last_synced_at":"2025-03-19T06:31:12.893Z","repository":{"id":23406408,"uuid":"26768643","full_name":"SeleniumHQ/docker-selenium","owner":"SeleniumHQ","description":"Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation","archived":false,"fork":false,"pushed_at":"2024-10-28T02:57:14.000Z","size":4358,"stargazers_count":7953,"open_issues_count":43,"forks_count":2510,"subscribers_count":250,"default_branch":"trunk","last_synced_at":"2024-10-29T10:08:44.559Z","etag":null,"topics":["devops","docker","docker-selenium","kubernetes","kubernetes-selenium","selenium","selenium-grid","selenium-node","selenium-server","webdriver"],"latest_commit_sha":null,"homepage":"http://www.selenium.dev/docker-selenium/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SeleniumHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"selenium"}},"created_at":"2014-11-17T17:39:22.000Z","updated_at":"2024-10-28T15:47:19.000Z","dependencies_parsed_at":"2023-02-17T22:15:29.844Z","dependency_job_id":"c28c9712-3d05-451c-9cb4-fe26be8fcfe8","html_url":"https://github.com/SeleniumHQ/docker-selenium","commit_stats":{"total_commits":1521,"total_committers":221,"mean_commits":6.882352941176471,"dds":0.8040762656147271,"last_synced_commit":"35fafaf2e22601b9553ba4c9ad90196fc54b2d76"},"previous_names":[],"tags_count":376,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeleniumHQ%2Fdocker-selenium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeleniumHQ%2Fdocker-selenium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeleniumHQ%2Fdocker-selenium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeleniumHQ%2Fdocker-selenium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SeleniumHQ","download_url":"https://codeload.github.com/SeleniumHQ/docker-selenium/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244257251,"owners_count":20424131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","docker","docker-selenium","kubernetes","kubernetes-selenium","selenium","selenium-grid","selenium-node","selenium-server","webdriver"],"created_at":"2024-07-31T03:00:57.461Z","updated_at":"2025-03-19T06:31:12.884Z","avatar_url":"https://github.com/SeleniumHQ.png","language":"Shell","readme":"[![Build \u0026 test](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/build-test.yml/badge.svg)](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/build-test.yml)\n[![Deploys](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/deploy.yml/badge.svg)](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/deploy.yml)\n[![Release Charts](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/helm-chart-release.yml/badge.svg)](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/helm-chart-release.yml)\n[![Nightly](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/nightly.yml/badge.svg)](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/nightly.yml)\n[![Update Dev/Beta Browser Images](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/update-dev-beta-browser-images.yml/badge.svg)](https://github.com/SeleniumHQ/docker-selenium/actions/workflows/update-dev-beta-browser-images.yml)\n[![Releases downloads](https://img.shields.io/github/downloads/seleniumhq/docker-selenium/total.svg)](https://github.com/SeleniumHQ/docker-selenium/releases)\n\n# Docker images for the Selenium Grid Server\n\nThe project is made possible by volunteer contributors who have put in thousands of hours of their own time, \nand made the source code freely available under the [Apache License 2.0](LICENSE.md).\n\nThese Docker images come with a handful of tags to simplify its usage, have a look at them in one of \nour [releases](https://github.com/SeleniumHQ/docker-selenium/releases/tag/4.29.0-20250303).\n\nTo get notifications of new releases, add yourself as a \"Releases only\" watcher. \n\nThese images are published to the Docker Hub registry at [Selenium Docker Hub](https://hub.docker.com/u/selenium).\n\n## Community\n\nDo you need help to use these Docker images?\nTalk to us at https://www.selenium.dev/support/\n\n## Contents\n\n\u003c!-- TOC --\u003e\n* [Community](#community)\n* [Contents](#contents)\n* [Quick start](#quick-start)\n  * [Try them out in a ready-to-use GitPod environment!](#try-them-out-in-a-ready-to-use-gitpod-environment)\n* [Experimental Multi-Arch amd64/aarch64/armhf Images](#experimental-multi-arch-amd64aarch64armhf-images)\n* [Nightly Images](#nightly-images)\n* [Dev and Beta Channel Browser Images](#dev-and-beta-channel-browser-images)\n  * [Dev and Beta Standalone Mode](#dev-and-beta-standalone-mode)\n  * [Dev and Beta on the Grid](#dev-and-beta-on-the-grid)\n* [Environment Variables](#environment-variables)\n* [Execution modes](#execution-modes)\n  * [Standalone](#standalone)\n  * [Hub and Nodes](#hub-and-nodes)\n  * [Fully distributed mode - Router, Queue, Distributor, EventBus, SessionMap and Nodes](#fully-distributed-mode---router-queue-distributor-eventbus-sessionmap-and-nodes)\n* [Video recording](#video-recording)\n* [Video recording with dynamic file name based on metadata in tests](#video-recording-with-dynamic-file-name-based-on-metadata-in-tests)\n* [Video recording and uploading](#video-recording-and-uploading)\n* [Dynamic Grid](#dynamic-grid)\n  * [Configuration example](#configuration-example)\n  * [Share volumes config of Dynamic Grid container to node browser containers](#share-volumes-config-of-dynamic-grid-container-to-node-browser-containers)\n  * [Execution with Hub \u0026 Node roles](#execution-with-hub--node-roles)\n  * [Execution with Standalone roles](#execution-with-standalone-roles)\n  * [Using Dynamic Grid in different machines/VMs](#using-dynamic-grid-in-different-machinesvms)\n  * [Execution with Docker Compose](#execution-with-docker-compose)\n  * [Configuring the child containers](#configuring-the-child-containers)\n  * [Video recording, screen resolution, and time zones in a Dynamic Grid](#video-recording-screen-resolution-and-time-zones-in-a-dynamic-grid)\n  * [Time zone configuration via env variable](#time-zone-configuration-via-env-variable)\n* [Deploying to Kubernetes](#deploying-to-kubernetes)\n* [Configuring the containers](#configuring-the-containers)\n  * [SE_OPTS Selenium Configuration Options](#se_opts-selenium-configuration-options)\n  * [SE_JAVA_OPTS Java Environment Options](#se_java_opts-java-environment-options)\n  * [SE_BROWSER_ARGS_* Add arguments for launching browser](#se_browser_args_-add-arguments-for-launching-browser)\n  * [Node configuration options](#node-configuration-options)\n  * [Node configuration relay commands](#node-configuration-relay-commands)\n  * [Setting Sub Path](#setting-sub-path)\n  * [Setting Screen Resolution](#setting-screen-resolution)\n  * [Grid Url and Session Timeout](#grid-url-and-session-timeout)\n  * [Session request timeout](#session-request-timeout)\n  * [Increasing session concurrency per container](#increasing-session-concurrency-per-container)\n  * [Running in Headless mode](#running-in-headless-mode)\n  * [Stopping the Node/Standalone after N sessions have been executed](#stopping-the-nodestandalone-after-n-sessions-have-been-executed)\n  * [Automatic browser leftovers cleanup](#automatic-browser-leftovers-cleanup)\n  * [Mask sensitive information in console logs](#mask-sensitive-information-in-console-logs)\n  * [Secure Connection](#secure-connection)\n  * [Browser language and locale](#browser-language-and-locale)\n  * [Managing processes in container](#managing-processes-in-container)\n* [Building the images](#building-the-images)\n* [Build the images with specific versions](#build-the-images-with-specific-versions)\n* [Upgrade browser version in the images](#upgrade-browser-version-in-the-images)\n* [Waiting for the Grid to be ready](#waiting-for-the-grid-to-be-ready)\n  * [Adding a HEALTHCHECK to the Grid](#adding-a-healthcheck-to-the-grid)\n  * [Using a bash script to wait for the Grid](#using-a-bash-script-to-wait-for-the-grid)\n* [Install certificates for Chromium-based browsers](#install-certificates-for-chromium-based-browsers)\n* [Alternative method: Add certificates to existing Selenium based images for browsers](#alternative-method-add-certificates-to-existing-selenium-based-images-for-browsers)\n* [Debugging](#debugging)\n  * [Using a VNC client](#using-a-vnc-client)\n  * [Using your browser (no VNC client is needed)](#using-your-browser-no-vnc-client-is-needed)\n  * [Disabling VNC](#disabling-vnc)\n* [Tracing in Grid](#tracing-in-grid)\n* [Troubleshooting](#troubleshooting)\n  * [`--shm-size=\"2g\"`](#--shm-size2g)\n  * [Headless](#headless)\n  * [Mounting volumes to retrieve downloaded files](#mounting-volumes-to-retrieve-downloaded-files)\n  * [Mounting volumes to retrieve video files](#mounting-volumes-to-retrieve-video-files)\n* [Stargazers over time](#stargazers-over-time)\n\u003c!-- TOC --\u003e\n\n## Quick start\n\n1. Start a Docker container with Firefox\n\n```bash\ndocker run -d -p 4444:4444 -p 7900:7900 --shm-size=\"2g\" selenium/standalone-firefox:4.29.0-20250303\n```\n\n2. Point your WebDriver tests to http://localhost:4444\n\n3. That's it! \n\n4. (Optional) To see what is happening inside the container, head to \u003chttp://localhost:7900/?autoconnect=1\u0026resize=scale\u0026password=secret\u003e.\n\nFor more details about visualising the container activity, check the [Debugging](#debugging) section.\n\n:point_up: When executing `docker run` for an image that contains a browser please use \nthe flag `--shm-size=2g` to use the host's shared memory.\n  \n:point_up: Always use a Docker image with a full tag to pin a specific browser and Grid version.\nSee [Tagging Conventions](https://github.com/SeleniumHQ/docker-selenium/wiki/Tagging-Convention) for details.\n\n### Try them out in a ready-to-use GitPod environment!\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/SeleniumHQ/docker-selenium)\n\n___\n\n## Experimental Multi-Arch amd64/aarch64/armhf Images\n\nFrom image tag based `4.21.0` onwards, the architectures supported by this project are as below:\n\n|       Architecture        | Available |\n|:-------------------------:|:---------:|\n|    x86_64 (aka amd64)     |     ✅     |\n| aarch64 (aka arm64/armv8) |     ✅     |\n| armhf (aka arm32/armv7l)  |     ❌     |\n\n### Browser images in multi-arch\n\nThe following browsers are available in multi-arch images:\n\n|       Architecture        | Chrome | Chromium | Firefox | Edge  |\n| :-----------------------: | :----: | :------: | :-----: | :---: |\n|    x86_64 (aka amd64)     |   ✅    |    ✅     |    ✅    |   ✅   |\n| aarch64 (aka arm64/armv8) |   ❌    |    ✅     |    ✅    |   ❌   |\n| armhf (aka arm32/armv7l)  |   ❌    |    ❌     |    ❌    |   ❌   |\n\nNote:\n\n- Google does not build Chrome (`google-chrome`) for Linux/ARM platforms. Hence, the Chrome (node and standalone) images are only available for AMD64.\nSimilarly, Microsoft does not build Edge (`microsoft-edge`) for Linux/ARM platforms.\n\n- Running an AMD64 image under emulation on an ARM64 platform is not recommended due to performance and [stability issues](https://github.com/SeleniumHQ/docker-selenium/issues/2298).\n\n- For Linux/ARM use the open source Chromium browser. The Chromium (node and standalone) images are available in multi-arch.\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 2g selenium/standalone-chromium:latest\n```\n\n- Mozilla Firefox now is available for Linux/ARM64 via APT stable channel from v136+. The Firefox (node and standalone) images are available in multi-arch.\n\nMulti-arch images are tested on CircleCI with resource class Linux/ARM64. See the status below.\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/SeleniumHQ/docker-selenium/tree/trunk.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/SeleniumHQ/docker-selenium/tree/trunk)\n\n### History of the multi-arch images\n\nFor experimental docker container images, which run on platforms such as the Apple M-series or Raspberry Pi,\nthe repository at\n[seleniumhq-community/docker-seleniarm](https://github.com/seleniumhq-community/docker-seleniarm) provided images which\nare published on the [Seleniarm Docker Hub](https://hub.docker.com/u/seleniarm) registry.\n\nSee issue [#1076](https://github.com/SeleniumHQ/docker-selenium/issues/1076) for more information on these images.\n\nNow, the fork [seleniumhq-community/docker-seleniarm](https://github.com/seleniumhq-community/docker-seleniarm) was merged.\n\n### Build the multi-arch images locally\n\nWe recommend to enable the experimental feature [containerd image store](https://docs.docker.com/storage/containerd/) in Docker Engine.\n`containerd` understands multiplatform images, where a single image tag can refer to different variants covering a range of OS and hardware architectures.\nIt simplifies the process of building, storing, and distributing images across different platforms.\n\nA single command to enable that feature in Docker Engine:\n\n```bash\nmake set_containerd_image_store\n```\n\nTo build all the images for multiplatform at once, run the following command:\n\n```bash\nPLATFORMS=linux/amd64,linux/arm64 make build\n```\n\nTo build the images for a specific platform, run the following command:\n\n```bash\nPLATFORMS=linux/arm64 make build\n```\n\nBy default, without specifying the `PLATFORMS` variable, the images are built with current host architecture.\n\nSimilarly, if you are using host ARM64 architecture, you can build the images for AMD64 architecture by running the following command:\n\n```bash\nPLATFORMS=linux/amd64 make build\n```\n\n___\n\n## Nightly Images\n\nNightly images are built on top of the [Nightly](https://github.com/SeleniumHQ/selenium/releases/tag/nightly) build on the upstream project [Selenium](https://github.com/SeleniumHQ/selenium) with the latest changes on main branch in this repository. The image tag is `nightly`. This is not recommended to use images in production. It is only for testing purpose.\n\n```bash\n$ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:nightly\n```\n\nCheck out the docker compose to get started with Nightly images [docker-compose-v3-full-grid-nightly.yml](docker-compose-v3-full-grid-nightly.yml)\n\n## Dev and Beta Channel Browser Images\n\nTo run tests or otherwise work with pre-release browsers, Google, Mozilla, and Microsoft maintain a Dev and Beta release channel for those who need to see what's soon to be released to the general population.  \n\n### Dev and Beta Standalone Mode\n\nHere are the instructions to run them in Standalone mode:\n\n**Chrome Beta:**\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalone-chrome:beta\n```\n\n**Chrome Dev:**\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalone-chrome:dev\n```\n\n**Firefox Beta:**\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalone-firefox:beta\n```\n\n**Firefox Dev:**\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalone-firefox:dev\n```\n\n**Edge Beta:**\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalone-edge:beta\n```\n\n**Edge Dev:**\n\n```bash\n$ docker run --rm -it -p 4444:4444 -p 7900:7900 --shm-size 2g selenium/standalone-edge:dev\n```\n\n### Dev and Beta on the Grid\n\n**docker-compose-v3-beta-channel.yml:**\n```bash\n# To execute this docker compose yml file use `docker compose -f docker-compose-v3-beta-channel.yml up`\n# Add the `-d` flag at the end for detached execution\n# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-beta-channel.yml down`\nservices:\n  chrome:\n    image: selenium/node-chrome:beta\n    shm_size: 2gb\n    depends_on:\n      - selenium-hub\n    environment:\n      - SE_EVENT_BUS_HOST=selenium-hub\n\n  edge:\n    image: selenium/node-edge:beta\n    shm_size: 2gb\n    depends_on:\n      - selenium-hub\n    environment:\n      - SE_EVENT_BUS_HOST=selenium-hub\n\n  firefox:\n    image: selenium/node-firefox:beta\n    shm_size: 2gb\n    depends_on:\n      - selenium-hub\n    environment:\n      - SE_EVENT_BUS_HOST=selenium-hub\n\n  selenium-hub:\n    image: selenium/hub:latest\n    container_name: selenium-hub\n    ports:\n      - \"4442:4442\"\n      - \"4443:4443\"\n      - \"4444:4444\"\n```\n\n**docker-compose-v3-dev-channel.yml:**\n```bash\n# To execute this docker compose yml file use `docker compose -f docker-compose-v3-dev-channel.yml up`\n# Add the `-d` flag at the end for detached execution\n# To stop the execution, hit Ctrl+C, and then `docker compose -f docker-compose-v3-dev-channel.yml down`\nservices:\n  chrome:\n    image: selenium/node-chrome:dev\n    shm_size: 2gb\n    depends_on:\n      - selenium-hub\n    environment:\n      - SE_EVENT_BUS_HOST=selenium-hub\n\n  edge:\n    image: selenium/node-edge:dev\n    shm_size: 2gb\n    depends_on:\n      - selenium-hub\n    environment:\n      - SE_EVENT_BUS_HOST=selenium-hub\n\n  firefox:\n    image: selenium/node-firefox:dev\n    shm_size: 2gb\n    depends_on:\n      - selenium-hub\n    environment:\n      - SE_EVENT_BUS_HOST=selenium-hub\n\n  selenium-hub:\n    image: selenium/hub:latest\n    container_name: selenium-hub\n    ports:\n      - \"4442:4442\"\n      - \"4443:4443\"\n      - \"4444:4444\"\n```\n\nFor more information on the Dev and Beta channel container images, see the blog post on [Dev and Beta Channel Browsers via Docker Selenium](https://www.selenium.dev/blog/2022/dev-and-beta-channel-browsers-via-docker-selenium/).\n\n## Environment Variables\n\n**Checkout full list of environment variables [here](ENV_VARIABLES.md).**\n\nHow to update or contribute to list of environment variables? Follow below steps:\n\n1. Refresh the list to pick up new environment variables or default value\n\n    ```bash\n    make update_list_env_vars\n    ```\n\n    The script can be updated in [scripts/generate_list_env_vars/extract_env.py](scripts/generate_list_env_vars/extract_env.py).\n\n2. Update the description for each environment variable in the file [scripts/generate_list_env_vars/description.yaml](scripts/generate_list_env_vars/description.yaml).\n\n3. Run the command in step (1) one more time to update the list of environment variables with new descriptions.\n\n## Execution modes\n\n### Standalone\n\n![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_24x24.png) Firefox \n```bash\ndocker run -d -p 4444:4444 --shm-size=\"2g\" selenium/standalone-firefox:4.29.0-20250303\n```\n\n![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_24x24.png) Chrome \n```bash\ndocker run -d -p 4444:4444 --shm-size=\"2g\" selenium/standalone-chrome:4.29.0-20250303\n```\n\n![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_24x24.png) Edge\n```bash\ndocker run -d -p 4444:4444 --shm-size=\"2g\" selenium/standalone-edge:4.29.0-20250303\n```\n\n_Note: Only one Standalone container can run on port_ `4444` _at the same time._\n\n___\n\n### Hub and Nodes\n\nThere are different ways to run the images and create a Grid with a Hub and Nodes, check the following options.\n\n#### Docker networking\nThe Hub and Nodes will be created in the same network and they will recognize each other by their container name.\nA Docker [network](https://docs.docker.com/engine/reference/commandline/network_create/) needs to be created as a first step.\n\n##### macOS/Linux\n\n```bash\n$ docker network create grid\n$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n    selenium/node-chrome:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n    selenium/node-edge:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n    selenium/node-firefox:4.29.0-20250303\n```\n\n##### Windows PowerShell\n\n```powershell\n$ docker network create grid\n$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `\n    --shm-size=\"2g\" `\n    selenium/node-chrome:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `\n    --shm-size=\"2g\" `\n    selenium/node-edge:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `\n    --shm-size=\"2g\" `\n    selenium/node-firefox:4.29.0-20250303\n```\n\nWhen you are done using the Grid, and the containers have exited, the network can be removed with the following command:\n\n``` bash\n# Removes the grid network\n$ docker network rm grid\n```\n\n#### Using different machines/VMs\nThe Hub and Nodes will be created on different machines/VMs, they need to know each other's IPs to\ncommunicate properly. If more than one node will be running on the same Machine/VM, they must be\nconfigured to expose different ports.\n\n##### Hub - Machine/VM 1\n```bash\n$ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.29.0-20250303\n```\n\n##### Node Chrome - Machine/VM 2\n\n###### macOS/Linux\n\n```bash\n$ docker run -d -p 5555:5555 \\\n    --shm-size=\"2g\" \\\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e \\\n    -e SE_NODE_HOST=\u003cip-from-machine-2\u003e \\\n    selenium/node-chrome:4.29.0-20250303\n```\n\n###### Windows PowerShell\n\n```powershell\n$ docker run -d -p 5555:5555 `\n    --shm-size=\"2g\" `\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e `\n    -e SE_NODE_HOST=\u003cip-from-machine-2\u003e `\n    selenium/node-chrome:4.29.0-20250303\n```\n\n\n##### Node Edge - Machine/VM 3\n\n###### macOS/Linux\n\n```bash\n$ docker run -d -p 5555:5555 \\\n    --shm-size=\"2g\" \\\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e \\\n    -e SE_NODE_HOST=\u003cip-from-machine-3\u003e \\\n    selenium/node-edge:4.29.0-20250303\n```\n\n###### Windows PowerShell\n\n```powershell\n$ docker run -d -p 5555:5555 `\n    --shm-size=\"2g\" `\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e `\n    -e SE_NODE_HOST=\u003cip-from-machine-3\u003e `\n    selenium/node-edge:4.29.0-20250303\n```\n\n##### Node Firefox - Machine/VM 4\n\n###### macOS/Linux\n\n```bash\n$ docker run -d -p 5555:5555 \\\n    --shm-size=\"2g\" \\\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e \\\n    -e SE_NODE_HOST=\u003cip-from-machine-4\u003e \\\n    selenium/node-firefox:4.29.0-20250303\n```\n\n###### Windows PowerShell\n\n```powershell\n$ docker run -d -p 5555:5555 `\n    --shm-size=\"2g\" `\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e `\n    -e SE_NODE_HOST=\u003cip-from-machine-4\u003e `\n    selenium/node-firefox:4.29.0-20250303\n```\n\n##### Node Chrome - Machine/VM 4\n\n###### macOS/Linux\n\n``` bash\n$ docker run -d -p 5556:5556 \\\n    --shm-size=\"2g\" \\\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e \\\n    -e SE_NODE_HOST=\u003cip-from-machine-4\u003e \\\n    -e SE_NODE_PORT=5556 \\\n    selenium/node-chrome:4.29.0-20250303\n```\n\n###### Windows PowerShell\n\n```powershell\n$ docker run -d -p 5556:5556 `\n    --shm-size=\"2g\" `\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e `\n    -e SE_NODE_HOST=\u003cip-from-machine-4\u003e `\n    -e SE_NODE_PORT=5556 `\n    selenium/node-chrome:4.29.0-20250303\n```\n\n#### Docker Compose\n[Docker Compose](https://docs.docker.com/compose/) is the simplest way to start a Grid. Use the\nlinked resources below, save them locally and check the execution instructions on top of each file.\n\n##### Version 2\n[`docker-compose-v2.yml`](docker-compose-v2.yml)\n\n##### Version 3\n[`docker-compose-v3.yml`](docker-compose-v3.yml)\n\nTo stop the Grid and cleanup the created containers, run `docker compose down`.\n\n##### Version 3 with Swarm support \n[`docker-compose-v3-swarm.yml`](docker-compose-v3-swarm.yml)\n\n___\n\n### Fully distributed mode - Router, Queue, Distributor, EventBus, SessionMap and Nodes\n\nIt is possible to start a Selenium Grid with all its components apart. For simplicity, only an\nexample with docker compose will be provided. Save the file locally, and check the execution \ninstructions on top of it.\n\n[`docker-compose-v3-full-grid.yml`](docker-compose-v3-full-grid.yml)\n\n#### Distributor configuration\n\n| Environment variable         | Option                      | Type    | Default value | Description                                                                                                  |\n|------------------------------|-----------------------------|---------|---------------|--------------------------------------------------------------------------------------------------------------|\n| `SE_REJECT_UNSUPPORTED_CAPS` | `--reject-unsupported-caps` | boolean | `false`       | Allow the Distributor to reject a request immediately if the Grid does not support the requested capability. |\n| `SE_HEALTHCHECK_INTERVAL`    | `--healthcheck-interval`    | int     | `120`         | This ensures the server can ping all the Nodes successfully after an interval.                               |\n\n___\n\n## Video recording\n\nTests execution can be recorded by using the `selenium/video:ffmpeg-7.1-20250303`\nDocker image. One container is needed per each container where a browser is running. This means if you are\nrunning 5 Nodes/Standalone containers, you will need 5 video containers, the mapping is 1-1.\n\nCurrently, the only way to do this mapping is manually (either starting the containers manually or through\n`docker compose`). We are iterating on this process and probably this setup will be more simple in the future.\n\nThe video Docker image we provide is based on the ffmpeg Ubuntu image provided by the \n[jrottenberg/ffmpeg](https://github.com/jrottenberg/ffmpeg) project, thank you for providing this image and\nsimplifying our work :tada:\n\nFrom image tag based `4.20.0` onwards, the video Docker image is based on the FFmpeg Ubuntu image provided by\n[linuxserver/docker-ffmpeg](https://github.com/linuxserver/docker-ffmpeg) project since the image is available for multi-platform.\nThank you for simplifying our project and helping us move forward with multiple architecture support.\n\n**Notes**:\n- If you have questions or feedback, please use the community contact points shown [here](https://www.selenium.dev/support/). \n- Please report any bugs through GitHub [issues](https://github.com/SeleniumHQ/docker-selenium/issues/new/choose), and provide\nall the information requested on the template.\n- Video recording for headless browsers is not supported. \n- Video recording tends to use considerable amounts of CPU. Normally you should estimate 1CPU per video container, \nand 1 CPU per browser container.\n- Videos are stored in the `/videos` directory inside the video container. Map a local directory to get the videos.\n- If you are running more than one video container, be sure to overwrite the video file name through the `FILE_NAME`\nenvironment variable to avoid unexpected results.\n\nThis example shows how to start the containers manually:\n\n``` bash\n$ docker network create grid\n$ docker run -d -p 4444:4444 -p 6900:5900 --net grid --name selenium --shm-size=\"2g\" selenium/standalone-chrome:4.29.0-20250303\n$ docker run -d --net grid --name video -v /tmp/videos:/videos selenium/video:ffmpeg-7.1-20250303\n# Run your tests\n$ docker stop video \u0026\u0026 docker rm video\n$ docker stop selenium \u0026\u0026 docker rm selenium\n```\nAfter the containers are stopped and removed, you should see a video file on your machine's `/tmp/videos` directory.\n\nHere is an example using a Hub and a few Nodes:\n\n[`docker-compose-v3-video.yml`](docker-compose-v3-video.yml)\n\n## Video recording with dynamic file name based on metadata in tests\n\nBased on the support of [Metadata in tests](https://www.selenium.dev/documentation/grid/getting_started/#metadata-in-tests). When the video recorder is sidecar deployed with the browser node with enabling `SE_VIDEO_FILE_NAME=auto` and adding metadata to your tests, video file name will extract value of capability `se:name` and use it as the video file name.\n\nFor example in Python binding:\n\n```python\nfrom selenium.webdriver.chrome.options import Options as ChromeOptions\nfrom selenium import webdriver\n\noptions = ChromeOptions()\noptions.set_capability('se:name', 'test_visit_basic_auth_secured_page (ChromeTests)')\ndriver = webdriver.Remote(options=options, command_executor=\"http://localhost:4444\")\ndriver.get(\"https://selenium.dev\")\ndriver.quit()\n```\n\nThe output video file name will be `test_visit_basic_auth_secured_page_ChromeTests_\u003csessionId\u003e.mp4`.\n\nIf your test name is handled by the test framework, and it is unique for sure, you also can disable the session id appends to the video file name by setting `SE_VIDEO_FILE_NAME_SUFFIX=false`.\n\nFile name will be trimmed to 255 characters to avoid long file names. Moreover, `space` character will be replaced by `_` and only characters alphabets, numbers, `-` (hyphen), `_` (underscore) are retained in the file name.\n\nThe trim regex is able to be customized by setting `SE_VIDEO_FILE_NAME_TRIM_REGEX` environment variable. The default value is `[:alnum:]-_`. The regex should be compatible with the `tr` command in bash.\n\nAt deployment level, the recorder container is up always. In addition, you can disable video recording process via session capability `se:recordVideo`. For example in Python binding:\n\n```python\noptions.set_capability('se:recordVideo', False)\n```\n\nIn recorder container will perform query GraphQL in Hub based on Node SessionId and extract the value of `se:recordVideo` in capabilities before deciding to start video recording process or not.\n\nNotes: To reach the GraphQL endpoint, the recorder container needs to know the Hub URL. The Hub URL can be passed via environment variable `SE_NODE_GRID_URL`. For example `SE_NODE_GRID_URL` is `http://selenium-hub:4444`.\n\n## Video recording and uploading\n\n[RCLONE](https://rclone.org/) is installed in the video recorder image. You can use it to upload the videos to a cloud storage service.\nBesides the video recording mentioned above, you can enable the upload functionality by setting the following environment variables:\n\n```yaml\nservices:\n  chrome_video:\n    image: selenium/video:ffmpeg-7.1-20250303\n    depends_on:\n      - chrome\n    environment:\n      - DISPLAY_CONTAINER_NAME=chrome\n      - SE_VIDEO_FILE_NAME=auto\n      - SE_VIDEO_UPLOAD_ENABLED=true\n      - SE_UPLOAD_DESTINATION_PREFIX=s3://mybucket/path\n      - RCLONE_CONFIG_S3_TYPE=s3\n      - RCLONE_CONFIG_S3_PROVIDER=GCS\n      - RCLONE_CONFIG_S3_ENV_AUTH=true\n      - RCLONE_CONFIG_S3_REGION=asia-southeast1\n      - RCLONE_CONFIG_S3_LOCATION_CONSTRAINT=asia-southeast1\n      - RCLONE_CONFIG_S3_ACL=private\n      - RCLONE_CONFIG_S3_ACCESS_KEY_ID=xxx\n      - RCLONE_CONFIG_S3_SECRET_ACCESS_KEY=xxx\n      - RCLONE_CONFIG_S3_ENDPOINT=https://storage.googleapis.com\n      - RCLONE_CONFIG_S3_NO_CHECK_BUCKET=true\n```\n\n`SE_VIDEO_FILE_NAME=auto` will use the session id as the video file name. This ensures that the video file name is unique to upload.\nVideo file name construction automatically works based on Node endpoint `/status` (and optional GraphQL endpoint) to get session ID, capabilities.\n\n`SE_VIDEO_UPLOAD_ENABLED=true` (`false` by default) will enable the video upload feature. In the background, it will create a pipefile with file and destination for uploader to consume and proceed.\n\n`SE_VIDEO_INTERNAL_UPLOAD=true` (by default) will use RCLONE installed in the container for upload. If you want to use another sidecar container for upload, set it to `false`.\n\n| ENV variables per mode                   | Hub/Nodes         | Standalone roles | Dynamic Grid   |\n|------------------------------------------|-------------------|------------------|----------------|\n| `SE_VIDEO_RECORD_STANDALONE` (mandatory) | `false` (default) | `true`           | `true`         |\n| `DISPLAY_CONTAINER_NAME` (mandatory)     | user input        | user input       | (not required) |\n| `SE_NODE_PORT` (optional)                | `5555`            | `4444`           | (not required) |\n| `SE_NODE_GRID_URL` (optional)            | user input        | (not required)   | (not required) |\n\nFor environment variables with prefix `RCLONE_` is used to pass remote configuration to RCLONE. You can find more information about RCLONE configuration [here](https://rclone.org/docs/).\nWhen using in Dynamic Grid, those variables should be combined with the prefix `SE_`, for example `SE_RCLONE_`. See below reference for more details.\n\n### Reference\n- Configure video recording and uploading for Hub and Nodes: [docker-compose-v3-video-upload.yml](docker-compose-v3-video-upload.yml)\n\n- Configure video recording and uploading for Standalone roles: [docker-compose-v3-video-upload-standalone.yml](docker-compose-v3-video-upload-standalone.yml)\n\n- Configure video recording and uploading for Dynamic Grid (node-docker): [docker-compose-v3-video-upload-dynamic-grid.yml](docker-compose-v3-video-upload-dynamic-grid.yml)\n\n- Configure video recording and uploading for Dynamic Grid standalone (standalone-docker): [tests/docker-compose-v3-test-standalone-docker.yaml](tests/docker-compose-v3-test-standalone-docker.yaml)\n\n### Environment variables and default values for upload feature\n\n| Environment variable          | Default value                                | Description                                                                               |\n|-------------------------------|----------------------------------------------|-------------------------------------------------------------------------------------------|\n| `SE_UPLOAD_RETAIN_LOCAL_FILE` | `false`                                      | Keep local file after uploading successfully                                              |\n| `SE_UPLOAD_COMMAND`           | `copy`                                       | RCLONE command is used to transfer file. Enforce `move` when retain local file is `false` |\n| `SE_UPLOAD_OPTS`              | `-P --cutoff-mode SOFT --metadata --inplace` | Other options belong to RCLONE command can be set.                                        |\n| `SE_UPLOAD_CONFIG_FILE_NAME`  | `upload.conf`                                | Config file for remote host instead of set via env variable prefix SE_RCLONE_*            |\n| `SE_UPLOAD_CONFIG_DIRECTORY`  | `/opt/bin`                                   | Directory of config file (change it when conf file in another directory is mounted)       |\n\n___\n\n## Dynamic Grid\n\nGrid 4 has the ability to start Docker containers on demand, this means that it starts\na Docker container in the background for each new session request, the test gets executed\nthere, and when the test completes, the container gets thrown away.\n\nThis execution mode can be used either in the Standalone or Node roles. The \"dynamic\"\nexecution mode needs to be told what Docker images to use when the containers get started.\nAdditionally, the Grid needs to know the URI of the Docker daemon. This configuration can\nbe placed in a local `toml` file.\n\n### Configuration example\n\nYou can save this file locally and name it, for example, `config.toml`.\n```toml\n[docker]\n# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to\n# start a container with the given image.\nconfigs = [\n    \"selenium/standalone-firefox:4.29.0-20250303\", '{\"browserName\": \"firefox\"}',\n    \"selenium/standalone-chrome:4.29.0-20250303\", '{\"browserName\": \"chrome\"}',\n    \"selenium/standalone-edge:4.29.0-20250303\", '{\"browserName\": \"MicrosoftEdge\"}'\n]\n\nhost-config-keys = [\"Dns\", \"DnsOptions\", \"DnsSearch\", \"ExtraHosts\", \"Binds\"]\n\n# URL for connecting to the docker daemon\n# Most simple approach, leave it as http://127.0.0.1:2375, and mount /var/run/docker.sock.\n# 127.0.0.1 is used because internally the container uses socat when /var/run/docker.sock is mounted \n# If var/run/docker.sock is not mounted: \n# Windows: make sure Docker Desktop exposes the daemon via tcp, and use http://host.docker.internal:2375.\n# macOS: install socat and run the following command, socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock,\n# then use http://host.docker.internal:2375.\n# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.\nurl = \"http://127.0.0.1:2375\"\n# Docker image used for video recording\nvideo-image = \"selenium/video:ffmpeg-7.1-20250303\"\n\n# Uncomment the following section if you are running the node on a separate VM\n# Fill out the placeholders with appropriate values\n#[server]\n#host = \u003cip-from-node-machine\u003e\n#port = \u003cport-from-node-machine\u003e\n```\n\nWith the optional config key `host-config-keys` under section [docker] in a config.toml file (or CLI option --docker-host-config-keys). Users can specify a list of docker host configuration keys that should be passed to browser containers.\n\nValid key names for Docker host config can be found in the Docker API [documentation](https://docs.docker.com/engine/api/latest/#tag/Container/operation/ContainerCreate) or via the command `docker inspect` the node-docker container.\n\n### Share volumes config of Dynamic Grid container to node browser containers\n\nIn case you want to access download directory in node browser containers (e.g `/home/seluser/Downloads`) via volumes config of Dynamic Grid container, you can add the following config to the `config.toml` file\n\n```toml\n[docker]\nhost-config-keys = [\"Binds\"]\n```\n\nVolumes config in docker compose file\n\n```yaml\nservices:\n  node-docker:\n    image: selenium/node-docker:latest\n    volumes:\n      - ./assets:/opt/selenium/assets\n      - ./config.toml:/opt/selenium/docker.toml\n      - ./downloads:/home/seluser/Downloads\n      - /var/run/docker.sock:/var/run/docker.sock\n    environment:\n      - SE_NODE_DOCKER_CONFIG_FILENAME=docker.toml\n```\n\n`/opt/selenium/config.toml` is the default path for the config file in all images. Once volumes config is shared to node browser containers, its `config.toml` could be overwritten by node-docker container config file.\n\nIn this case, mount your `config.toml` file to `/opt/selenium/docker.toml` in node-docker container. And set the environment variable `SE_NODE_DOCKER_CONFIG_FILENAME=docker.toml` to specify that config file name for the startup script.\n\nRefer to example [docker-compose-v3-test-node-docker.yaml](./tests/docker-compose-v3-test-node-docker.yaml)\n\n### Execution with Hub \u0026 Node roles\n\nThis can be expanded to a full Grid deployment, all components deployed individually. The overall\nidea is to have the Hub in one virtual machine, and each of the Nodes in separate and more powerful\nvirtual machines. \n\n#### macOS/Linux\n\n```bash\n$ docker network create grid\n$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    -v ${PWD}/config.toml:/opt/selenium/config.toml \\\n    -v ${PWD}/assets:/opt/selenium/assets \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    selenium/node-docker:4.29.0-20250303\n```\n\n#### Windows PowerShell\n\n```powershell\n$ docker network create grid\n$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub `\n    -v ${PWD}/config.toml:/opt/selenium/config.toml `\n    -v ${PWD}/assets:/opt/selenium/assets `\n    -v /var/run/docker.sock:/var/run/docker.sock `\n    selenium/node-docker:4.29.0-20250303\n```\n\nTo have the assets saved on your host, please mount your host path to `/opt/selenium/assets`.\n\nWhen you are done using the Grid, and the containers have exited, the network can be removed with the following command:\n\n``` bash\n# Removes the grid network\n$ docker network rm grid\n```\n\n### Execution with Standalone roles\n\n#### macOS/Linux\n\n```bash\ndocker run --rm --name selenium-docker -p 4444:4444 \\\n    -v ${PWD}/config.toml:/opt/selenium/config.toml \\\n    -v ${PWD}/assets:/opt/selenium/assets \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    selenium/standalone-docker:4.29.0-20250303\n```\n\n#### Windows PowerShell\n\n```bash\ndocker run --rm --name selenium-docker -p 4444:4444 `\n    -v ${PWD}/config.toml:/opt/selenium/config.toml `\n    -v ${PWD}/assets:/opt/selenium/assets `\n    -v /var/run/docker.sock:/var/run/docker.sock `\n    selenium/standalone-docker:4.29.0-20250303\n```\n\n### Using Dynamic Grid in different machines/VMs\n\n#### Hub - Machine/VM 1\n\n```bash\n$ docker run -d -p 4442-4444:4442-4444 --name selenium-hub selenium/hub:4.29.0-20250303\n```\n\n#### Node Chrome - Machine/VM 2\n\n#### macOS/Linux\n\n```bash\n$ docker run -d -p 5555:5555 \\\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e \\\n    -v ${PWD}/config.toml:/opt/selenium/config.toml \\\n    -v ${PWD}/assets:/opt/selenium/assets \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    selenium/node-docker:4.29.0-20250303\n```\n\n#### Windows PowerShell\n\n```bash\n$ docker run -d -p 5555:5555 `\n    -e SE_EVENT_BUS_HOST=\u003cip-from-machine-1\u003e `\n    -v ${PWD}/config.toml:/opt/selenium/config.toml `\n    -v ${PWD}/assets:/opt/selenium/assets `\n    -v /var/run/docker.sock:/var/run/docker.sock `\n    selenium/node-docker:4.29.0-20250303\n```\n\nComplete the `[server]` section in the `config.toml` file.\n```toml\n[docker]\n# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to\n# start a container with the given image.\nconfigs = [\n    \"selenium/standalone-firefox:4.29.0-20250303\", \"{\\\"browserName\\\": \\\"firefox\\\"}\",\n    \"selenium/standalone-chrome:4.29.0-20250303\", \"{\\\"browserName\\\": \\\"chrome\\\"}\",\n    \"selenium/standalone-edge:4.29.0-20250303\", \"{\\\"browserName\\\": \\\"MicrosoftEdge\\\"}\"\n    ]\n\n# URL for connecting to the docker daemon\n# Most simple approach, leave it as http://127.0.0.1:2375, and mount /var/run/docker.sock.\n# 127.0.0.1 is used because interally the container uses socat when /var/run/docker.sock is mounted \n# If var/run/docker.sock is not mounted: \n# Windows: make sure Docker Desktop exposes the daemon via tcp, and use http://host.docker.internal:2375.\n# macOS: install socat and run the following command, socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock,\n# then use http://host.docker.internal:2375.\n# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.\nurl = \"http://127.0.0.1:2375\"\n# Docker image used for video recording\nvideo-image = \"selenium/video:ffmpeg-7.1-20250303\"\n\n# Uncomment the following section if you are running the node on a separate VM\n# Fill out the placeholders with appropriate values\n[server]\nhost = \u003cip-from-node-machine\u003e\nport = \u003cport-from-node-machine\u003e\n```\n\nTo have the assets saved on your host, please mount your host path to `/opt/selenium/assets`.\n\n### Execution with Docker Compose\n\nHere is an example using a Hub and a Node:\n\n[`docker-compose-v3-dynamic-grid.yml`](docker-compose-v3-dynamic-grid.yml)\n\n\n### Configuring the child containers\n\nContainers can be further configured through environment variables, such as `SE_NODE_SESSION_TIMEOUT`\nand `SE_OPTS`. When a child container is created, all environment variables prefixed with `SE_` will\nbe forwared and set in the container. You can set the desired environment variables in the \n`standalone-docker` or `node-docker` containers. The following example sets the session timeout to\n700 seconds for all sessions:\n\n#### macOS/Linux\n\n```bash\ndocker run --rm --name selenium-docker -p 4444:4444 \\\n    -e SE_NODE_SESSION_TIMEOUT=700 \\\n    -v ${PWD}/config.toml:/opt/selenium/config.toml \\\n    -v ${PWD}/assets:/opt/selenium/assets \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    selenium/standalone-docker:4.29.0-20250303\n```\n\n#### Windows PowerShell\n\n```bash\ndocker run --rm --name selenium-docker -p 4444:4444 `\n    -e SE_NODE_SESSION_TIMEOUT=700 `\n    -v ${PWD}/config.toml:/opt/selenium/config.toml `\n    -v ${PWD}/assets:/opt/selenium/assets `\n    -v /var/run/docker.sock:/var/run/docker.sock `\n    selenium/standalone-docker:4.29.0-20250303\n```\n\n### Video recording, screen resolution, and time zones in a Dynamic Grid\nTo record your WebDriver session, you need to add a `se:recordVideo` \nfield set to `true`. You can also set a time zone and a screen resolution,\nfor example:\n\n```json\n{\n  \"browserName\": \"firefox\",\n  \"platformName\": \"linux\",\n  \"se:recordVideo\": \"true\",\n  \"se:timeZone\": \"US/Pacific\",\n  \"se:screenResolution\": \"1920x1080\"  \n}\n```\n\nAfter running a test, check the path you mounted to the Docker container, \n(`${PWD}/assets`), and you should see videos and session information. \n\nFrom language bindings, you can set the `se:name` capability to change output video file name dynamically. For example, in Python binding:\n\n```python\nfrom selenium.webdriver.chrome.options import Options as ChromeOptions\nfrom selenium import webdriver\n\noptions = ChromeOptions()\noptions.set_capability('se:recordVideo', True)\noptions.set_capability('se:screenResolution', '1920x1080')\noptions.set_capability('se:name', 'test_visit_basic_auth_secured_page (ChromeTests)')\ndriver = webdriver.Remote(options=options, command_executor=\"http://localhost:4444\")\ndriver.get(\"https://selenium.dev\")\ndriver.quit()\n```\n\nAfter test executed, under (`${PWD}/assets`) you can see the video file name in path `/\u003csessionId\u003e/test_visit_basic_auth_secured_page_ChromeTests.mp4`\n\nThe file name will be trimmed to 255 characters to avoid long file names. Moreover, the `space` character will be replaced by `_`, and only the characters alphabets, numbers, `-` (hyphen), and `_` (underscore) are retained in the file name. (This feat is available once this [PR](https://github.com/SeleniumHQ/selenium/pull/13907) merged)\n\n### Time zone configuration via env variable\n\n`tzdata` is installed in based images, and you can set the time zone in container by using the env variable `TZ`.\nBy default, the time zone is set to `UTC`.\nList of supported time zones can be found [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). For example:\n\n```bash\n$ docker run --rm --entrypoint=\"\" -e TZ=Asia/Ho_Chi_Minh selenium/node-chromium:latest date +%FT%T%Z\n2024-08-28T18:19:26+07\n```\n\n___\n\n## Deploying to Kubernetes\n\nWe offer a Helm chart to deploy these Docker images to Kubernetes.\nRead more details at the Helm [readme](./charts/selenium-grid/README.md).\n\n___\n\n## Configuring the containers\n\n### SE_OPTS Selenium Configuration Options\n\nYou can pass `SE_OPTS` variable with additional command line parameters for starting a hub or a node.\n\n``` bash\n$ docker run -d -p 4444:4444 -e SE_OPTS=\"--log-level FINE\" --name selenium-hub selenium/hub:4.29.0-20250303\n```\n\n### SE_JAVA_OPTS Java Environment Options\n\nYou can pass `SE_JAVA_OPTS` environment variable to the Java process.\n\n``` bash\n$ docker run -d -p 4444:4444 -e SE_JAVA_OPTS=-Xmx512m --name selenium-hub selenium/hub:4.29.0-20250303\n```\n\n### SE_BROWSER_ARGS_* Add arguments for launching browser\n\nInstead of adding arguments via the browser options from language bindings, for example:\n\n```python\noptions = ChromeOptions()\noptions.add_argument('--incognito')\noptions.add_argument('--disable-dev-shm-usage')\ndriver = webdriver.Remote(options=options, command_executor=\"http://localhost:4444/wd/hub\")\n```\n\nYou also can proactive to force applying arguments directly from (node, standalone or node-docker) container environment variables. Define the environment variable with name starts with `SE_BROWSER_ARGS_` and following by config key is up to you (ensure those are unique when you define multiple arguments). For example:\n\n```bash\ndocker run -d -p 4444:4444 \\\n  -e SE_BROWSER_ARGS_INCOGNITO=--incognito \\\n  -e SE_BROWSER_ARGS_DISABLE_DSHM=--disable-dev-shm-usage \\\n  selenium/standalone-chrome:latest\n```\n\n[List chromium command-line arguments](https://peter.sh/experiments/chromium-command-line-switches/) for your reference.\n\nNote: Currently, this is applicable for node browsers Chrome/Chromium, Edge.\n\n### Node configuration options\n\nThe Nodes register themselves through the Event Bus. When the Grid is started in its typical Hub/Node\nsetup, the Hub will be the one acting as the Event Bus, and when the Grid is started with all its five\nelements apart, the Event Bus will be running on its own.\n\nIn both cases, it is necessary to tell the Node where the Event Bus is, so it can register itself. That is\nthe purpose of the `SE_EVENT_BUS_HOST`, `SE_EVENT_BUS_PUBLISH_PORT` and `SE_EVENT_BUS_SUBSCRIBE_PORT` environment\nvariables.\n\nIn some cases, for example, if you want to tag a node, it might be necessary to supply a custom stereotype to the node config. The environment variable `SE_NODE_STEREOTYPE`\nsets the stereotype entry in the node's `config.toml`. An example config.toml file can be found here: [Setting custom capabilities for matching specific Nodes](https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes).\n\nHere is an example with the default values of these environment variables:\n```bash\n$ docker run -d \\\n  -e SE_EVENT_BUS_HOST=\u003cevent_bus_ip|event_bus_name\u003e \\\n  -e SE_NODE_STEREOTYPE=\"{\\\"browserName\\\":\\\"${SE_NODE_BROWSER_NAME}\\\", \\\"browserVersion\\\":\\\"${SE_NODE_BROWSER_VERSION}\\\", \\\"platformName\\\":\\\"${SE_NODE_PLATFORM_NAME}\\\"}\" \\\n  --shm-size=\"2g\" selenium/node-chrome:4.29.0-20250303\n```\n\nIn another case, if you want to retain the default Node stereotype and append additional capabilities, you can use the `SE_NODE_STEREOTYPE_EXTRA` environment variable to set your capabilities. Those will be merged to the default stereotype. For example:\n```bash\n$ docker run -d \\\n  -e SE_EVENT_BUS_HOST=\u003cevent_bus_ip|event_bus_name\u003e \\\n  -e SE_NODE_STEREOTYPE_EXTRA=\"{\\\"myApp:version\\\":\\\"beta\\\", \\\"myApp:publish:\\\":\\\"public\\\"}\" \\\n  --shm-size=\"2g\" selenium/node-chrome:4.29.0-20250303\n```\n\nThis help setting custom capabilities for matching specific Nodes. For example, you added your custom capabilities when starting the Node, and you want assign a test to run on that Node which matches your capabilities. For example in test code:\n\n```python\noptions = ChromeOptions()\noptions.set_capability('myApp:version', 'beta')\noptions.set_capability('myApp:publish', 'public')\ndriver = webdriver.Remote(options=options, command_executor=SELENIUM_GRID_URL)\n```\n\nNoted: Your custom capabilities with key values should be in W3C capabilities convention, extension capabilities key must contain a \":\" (colon) character, denoting an implementation specific namespace.\n\nNoted: Ensure that Node config `detect-drivers = false` in `config.toml` (or `--detect-drivers false` in CLI option) to make feature setting custom capabilities for matching specific Nodes get working.\n\nIn addition, default Node stereotype includes capability `se:containerName` which can visible in node capabilities, or session capabilities to identify the container name where the node/session is running. **The prefixed `se:containerName` is not included in slot matcher**. By default, value is getting from `hostname` command in container, this value is equivalent to the `container_id` that you saw via `docker ps` command. If you want to override this value, you can set the environment variable `SE_NODE_CONTAINER_NAME` to your desired value. For example, when deploy to Kubernetes cluster, you can assign Pod name to env var `SE_NODE_CONTAINER_NAME` to track a node is running in which Pod.\n\n```yaml\n  env:\n    - name: SE_NODE_CONTAINER_NAME\n      valueFrom:\n        fieldRef:\n          fieldPath: metadata.name\n```\n\nIn an advanced case, where you control to spawn up a Node container, let it register to Hub, and then trigger a test to be assigned exactly to run on that Node. By default, the value of command `$(hostname)` is added to capability name `container:hostname` in Node stereotype. Combine with above feature setting custom capabilities for matching specific Nodes. You can use the `hostname` of the Node container just spawned up and set it as a custom capability. For example, in Python binding:\n\n```bash\n$ docker run -d --name my-node-1 -e SE_EVENT_BUS_HOST=localhost \\\n  --shm-size=\"2g\" selenium/node-chrome:4.29.0-20250303\n$ docker exec -i my-node-1 hostname\na6971f95bbab\n```\n\n```python\noptions = ChromeOptions()\noptions.set_capability('container:hostname', 'a6971f95bbab')\ndriver = webdriver.Remote(options=options, command_executor=SELENIUM_GRID_URL)\n```\n\n_Noted: Those above changes require new image tag where the changeset is included \u0026 released._\n\n### Node configuration relay commands\n\nRelaying commands to a service endpoint that supports WebDriver.\nIt is useful to connect an external service that supports WebDriver to Selenium Grid. An example of such service could be a cloud provider or an Appium server. \nIn this way, Grid can enable more coverage to platforms and versions not present locally.\n\nThe following is an en example of configuration relay commands.\n\n[docker-compose-v3-test-node-relay.yml](tests/docker-compose-v3-test-node-relay.yml)\n\nIf you want to relay commands only, `selenium/node-base` is suitable and lightweight for this purpose.\nIn case you want to configure node with both browsers and relay commands, respective node images can be used.\n\nTo use environment variables for generate relay configs, set `SE_NODE_RELAY_URL` and other variables as below. Those will be used to generate the default relay config in TOML format looks like below.\n\n```toml\n[relay]\nurl = \"${SE_NODE_RELAY_URL}\"\nstatus-endpoint = \"${SE_NODE_RELAY_STATUS_ENDPOINT}\"\nprotocol-version = \"${SE_NODE_RELAY_PROTOCOL_VERSION}\"\nconfigs = [ '${SE_NODE_RELAY_MAX_SESSIONS}', '{\"browserName\": \"${SE_NODE_RELAY_BROWSER_NAME}\", \"platformName\": \"${SE_NODE_RELAY_PLATFORM_NAME}\", \"appium:platformVersion\": \"${SE_NODE_RELAY_PLATFORM_VERSION}\"}' ]\n```\n\nInstead of input value for each environment variable to construct the default relay stereotype, you can use the `SE_NODE_RELAY_STEREOTYPE` environment variable to overwrite the default relay stereotype with your custom stereotype.\n\nIn another case, if you want to retain the default relay stereotype and append additional capabilities, you can use the `SE_NODE_RELAY_STEREOTYPE_EXTRA` environment variable to set your capabilities. Those will be merged to the default relay stereotype.\n\nTo run a sample test with the relayed node, you can clone the project and try below command:\n\n```bash\nmake test_node_relay\n```\n\n### Setting Sub Path\n\nBy default, Selenium is reachable at `http://127.0.0.1:4444/`. Selenium can be configured to use a custom subpath by specifying the `SE_SUB_PATH`\nenvironmental variable. In the example below Selenium is reachable at `http://127.0.0.1:4444/selenium-grid/`\n\n```bash\n$ docker run -d -p 4444:4444 -e SE_SUB_PATH=/selenium-grid/ --name selenium-hub selenium/hub:4.29.0-20250303\n```\n\n### Setting Screen Resolution\n\nBy default, nodes start with a screen resolution of 1920 x 1080 with a color depth of 24 bits and a dpi of 96. \nThese settings can be adjusted by specifying `SE_SCREEN_WIDTH`, `SE_SCREEN_HEIGHT`, `SE_SCREEN_DEPTH`, and/or `SE_SCREEN_DPI` \nenvironmental variables when starting the container.\n\n``` bash\ndocker run -d -e SE_SCREEN_WIDTH=1366 -e SE_SCREEN_HEIGHT=768 -e SE_SCREEN_DEPTH=24 -e SE_SCREEN_DPI=74 selenium/standalone-firefox:4.29.0-20250303\n```\n\n### Grid Url and Session Timeout\n\nIn some use cases, you might need to set the Grid URL to the Node, for example, if you'd like to access the BiDi/CDP endpoint. \nThis is also needed when you want to use the new `RemoteWebDriver.builder()` or `Augmenter()` present in Selenium 4 \n(since they setup the BiDi/CDP connection implicitly). You can do that through the `SE_NODE_GRID_URL` environment \nvariable, eg `-e SE_NODE_GRID_URL=http://\u003chostMachine\u003e:4444`. Setting this env var is needed if you want to see the live view while sessions are executing.\n\nGrid has a default session timeout of 300 seconds, where the session can be in a stale state until it is killed. You can use\n`SE_NODE_SESSION_TIMEOUT` to overwrite that value in seconds.\n\n\n### Session request timeout\n\nA new session request is placed in the Session Queue before it is processed, and the request sits in the queue until a matching\nslot is found across the registered Nodes. However, the new session request might timeout if no slot was found. By default, a \nrequest will stay in the queue for up to 300 seconds before it a timeout is reached. In addition, an attempt to process the request\nis done every 5 seconds (by default).\n\nIt is possible to override those values through environment variables in the Hub and the SessionQueue (`SE_SESSION_REQUEST_TIMEOUT`\nand `SE_SESSION_RETRY_INTERVAL`). For example, a timeout of 500 seconds would be `SE_SESSION_REQUEST_TIMEOUT=500` and a retry \ninterval of 2 seconds would be `SE_SESSION_RETRY_INTERVAL=2`.\n\n### Increasing session concurrency per container\n\nBy default, only one session is configured to run per container through the `SE_NODE_MAX_SESSIONS` environment variable. It is\npossible to increase that number up to the maximum available processors, this is because more stability is achieved when one\ncontainer/browser has 1 CPU to run. \n\nHowever, if you have measured performance and based on that, you think more sessions can be executed in each container, you can\noverride the maximum limit by setting both `SE_NODE_MAX_SESSIONS` to a desired number and `SE_NODE_OVERRIDE_MAX_SESSIONS` to \n`true`. Nevertheless, running more browser sessions than the available processors is not recommended since you will be overloading\nthe resources.\n\nOverriding this setting has an undesired side effect when video recording is enabled since more than one browser session might be\ncaptured in the same video.\n\n### Running in Headless mode\n\n[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode),\n[Chrome](https://developer.chrome.com/docs/chromium/headless),\nWhen using headless mode, there's no need for the [Xvfb](https://en.wikipedia.org/wiki/Xvfb) server to be started.\n\nTo avoid starting the server you can set the `SE_START_XVFB` environment variable to `false` \n(or any other value than `true`), for example:\n\n``` bash\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n  -e SE_START_XVFB=false --shm-size=\"2g\" selenium/node-chrome:4.29.0-20250303\n```\n\nFor more information, see this GitHub [issue](https://github.com/SeleniumHQ/docker-selenium/issues/567).\n\nNoted:\n- In new Chrome/Chromium versions (v127+), `SE_START_XVFB` is required to be set to `true` to run in `--headless=new` mode.\n\n### Stopping the Node/Standalone after N sessions have been executed\n\nIn some environments, like Docker Swarm or Kubernetes, it is useful to shut down the Node or Standalone\ncontainer after N tests have been executed. For example, this can be used in Kubernetes to terminate the\npod and then scale a new one after N sessions. Set the environment variable `SE_DRAIN_AFTER_SESSION_COUNT` to\na value higher than zero to enable this behaviour. \n\n``` bash\n$ docker run -e SE_DRAIN_AFTER_SESSION_COUNT=5 --shm-size=\"2g\" selenium/standalone-firefox:4.29.0-20250303\n```\n\nWith the previous command, the Standalone container will shut down after 5 sessions have been executed.\n\n### Automatic browser leftovers cleanup\n\nIn long-running containers, it can happen that browsers leave some leftovers. These can be stuck browser processes\nof jobs that have already finished but failed to fully stop the browser, or temporary files written to the `/tmp`\nfile system (notably on Chrome-based browsers). To avoid these filling up resources like process IDs and file system\nusage in the container, there is an automatic cleanup script running every hour in the node containers. This will\nclean up old processes and old temporary files. By default, this is disabled. When enabled, this will clean up browsers\nrunning for longer than 2 hours, and files older than 1 day. These can be enabled and tweaked with the following\nenvironment variables:\n\n* `SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP`: default value `false`, set to `true` to enable the cleanup.\n* `SE_BROWSER_LEFTOVERS_INTERVAL_SECS`: default value `3600` (1 hour), cleanup interval in seconds.\n* `SE_BROWSER_LEFTOVERS_PROCESSES_SECS`: default value `7200` (2 hours), browsers running for longer than this time will be killed.\n* `SE_BROWSER_LEFTOVERS_TEMPFILES_DAYS`: default value `1` (1 day), files generated by Chrome-based browsers in `/tmp` will be removed after these number of days (ignored when using Firefox).\n\nIf you use Selenium for long-running sessions and expect browsers to be running for longer than 2 hours, either do\nnot set `SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP` to `true` (leave the default value of `false`), or tweak\n`SE_BROWSER_LEFTOVERS_PROCESSES_SECS` to set a value higher than your expected long-running browser processes.\n\n``` bash\n$ docker run -e SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true --shm-size=\"2g\" selenium/node-chrome:4.29.0-20250303\n```\n\nWith the previous command, the cleanup will be enabled with the default timings.\n\n``` bash\n$ docker run -e SE_ENABLE_BROWSER_LEFTOVERS_CLEANUP=true \\\n-e SE_BROWSER_LEFTOVERS_INTERVAL_SECS=7200 \\\n-e SE_BROWSER_LEFTOVERS_PROCESSES_SECS=3600 \\\n-e SE_BROWSER_LEFTOVERS_TEMPFILES_DAYS=2 \\\n--shm-size=\"2g\" selenium/node-chrome:4.29.0-20250303\n```\n\nWith the previous command, the cleanup will be enabled, but will run every 2 hours (instead of 1), will kill browsers\nrunning longer than 1 hour (instead of 2 hours), and will remove temp files older than 2 days (instead of 1).\n\n---\n\n## Mask sensitive information in console logs\n\nFew variables output like password, secret, etc. are masked in console logs. For debugging purposes, you can disable it by setting `SE_MASK_SECRETS` to `false`\n\nWhile creating bash script, your can mask the output by using syntax `echo \"Current value is $(mask ${YOUR_VARIABLE})`\n\n`SE_MASK_SECRETS_MIN_LENGTH` default is `3`. It means a long string will be masked to `***` to avoid exposing length for brute force attack.\n\n## Secure connection\n\nBy default, there are default self-signed certificates available in the image in location `/opt/selenium/secrets` includes\n- `server.jks`: truststore file to configure for JVM via system property `javax.net.ssl.trustStore` when start the server.\n- `server.pass`: file contains the truststore password for JVM via system property `javax.net.ssl.trustStorePassword`.\n- `tls.crt`: Server certificate for https connection is set to Selenium option `--https-certificate`.\n- `tls.key`: Server private key (in PKCS8 format) for https connection is set to Selenium option `--https-private-key`.\n\nThere are environment variables to configure the secure connection:\n\n| Environment variables                 | Default                             | Option of | Description                                   |\n|---------------------------------------|-------------------------------------|-----------|-----------------------------------------------|\n| SE_ENABLE_TLS                         | `false`                             |           | Enable secure connection with default configs |\n| SE_JAVA_SSL_TRUST_STORE               | `/opt/selenium/secrets/server.jks`  | JVM       |                                               |\n| SE_JAVA_SSL_TRUST_STORE_PASSWORD      | `/opt/selenium/secrets/server.pass` | JVM       |                                               |\n| SE_JAVA_DISABLE_HOSTNAME_VERIFICATION | `true`                              | JVM       | Disable host checks for components internally |\n| SE_HTTPS_CERTIFICATE                  | `/opt/selenium/secrets/tls.crt`     | Selenium  | Set to CLI option `--https-certificate`       |\n| SE_HTTPS_PRIVATE_KEY                  | `/opt/selenium/secrets/tls.key`     | Selenium  | Set to CLI option `--https-private-key`       |\n\nVia volume mount, you can replace the default certificates with your own certificates.\n\nThe self-signed certificate also needs to be trusted by the client (add to system widely bundle trusted CA) to avoid error message relates to SSL handshake when creating RemoteWebDriver.\n\nRefer to sample: [`docker-compose-v3-full-grid-secure.yml`](docker-compose-v3-full-grid-secure.yml)\n\n## Browser language and locale\n\nDifferent browsers have different ways to set the language and locale from binding.\n\n### Firefox\n\nFirefox can be configured to use a specific language and locale by setting the profile preference when create WebDriver from binding. In addition, language pack need to be installed as add-on for browser UI language to take effect. For example, to set the browser language and locale to `vi-VN`, you can use the following steps:\n\nGet the latest Firefox language pack for the desired language e.g. https://download.mozilla.org/?product=firefox-langpack-latest-SSL\u0026lang=vi. Then, you can install the language pack as an add-on when creating the RemoteWebDriver instance.\n\n```python\nprofile = webdriver.FirefoxProfile()\nprofile.set_preference('intl.accept_languages', 'vi-VN,vi')\nprofile.set_preference('intl.locale.requested', 'vi-VN,vi')\noptions = FirefoxOptions()\noptions.profile = profile\ndriver = webdriver.Remote(options=options, command_executor=\"http://selenium-hub:4444/wd/hub\")\nwebdriver.Firefox.install_addon(driver, \"/local/path/to/vi.xpi\")\ndriver.get('https://google.com')\n```\n\nThere is a [script](NodeFirefox/get_lang_package.sh) to get all available language packs for a given Firefox version. You can run the script to get the language packs to your source. For example:\n\n```bash\nFIREFOX_VERSION=$(docker run --rm --entrypoint=\"\" selenium/node-firefox:latest firefox --version | awk '{print $3}') \\\n\u0026\u0026 ./NodeFirefox/get_lang_package.sh ${FIREFOX_VERSION} /local/path/to/download\n```\n\nOr, you can mount the container directory `$(readlink -f $(which firefox)))/distribution/extensions` to host directory to access packs were pre-built in the container for using in your test script.\n\n## Managing processes in container\n\n[Supervisor](http://supervisord.org/configuration.html) is used to manage processes and logs in the container. Few configuration for `supervisord` can be set via environment variables as below:\n\n| Environment variables        | Default                | `supervisord` config    |\n|------------------------------|------------------------|-------------------------|\n| SE_SUPERVISORD_LOG_LEVEL     | `info`                 | supervisord.loglevel    |\n| SE_SUPERVISORD_CHILD_LOG_DIR | `/tmp`                 | supervisord.childlogdir |\n| SE_SUPERVISORD_LOG_FILE      | `/tmp/supervisord.log` | supervisord.logfile     |\n| SE_SUPERVISORD_PID_FILE      | `/tmp/supervisord.pid` | supervisord.pidfile     |\n\n___\n\n## Building the images\n\nClone the repo and from the project directory root you can build everything by running:\n\n``` bash\n$ VERSION=local make build\n```\n\nIf you need to configure environment variables in order to build the image (http proxy for instance), \nsimply set an environment variable `BUILD_ARGS` that contains the additional variables to pass to the \ndocker context (this will only work with docker \u003e= 1.9)\n\n``` bash\n$ BUILD_ARGS=\"--build-arg http_proxy=http://acme:3128 --build-arg https_proxy=http://acme:3128\" make build\n```\n\n_Note: Omitting_ `VERSION=local` _will build the images with the released version but replacing the date for the \ncurrent one._\n\nIf you want to build the image with the host UID/GID, simply set an environment variable `BUILD_ARGS`\n\n``` bash\n$ BUILD_ARGS=\"--build-arg UID=$(id -u) --build-arg GID=$(id -g)\" make build\n```\n\nIf you want to build the image with different default user/password, simply set an environment variable `BUILD_ARGS`\n\n``` bash\n$ BUILD_ARGS=\"--build-arg SEL_USER=yourseluser --build-arg SEL_PASSWD=welcome\" make build\n```\n___\n\n# Build the images with specific versions\n\nBased on the latest Dockerfile (by cloning the repo and from the project directory root), you can build the images with a specific combination of Selenium Grid, and browser versions.\n\nFor example, you would like to build `node-chrome` and `standalone-chrome` images with the Grid based version `4.17.0`, Chrome browser versions `119`, `120`, `123` respectively.\n\n```bash\n$ ./tests/build-backward-compatible/bootstrap.sh 4.17.0 119,120,123 chrome\n```\n\nIn generic, the script takes the following arguments:\n- `$1` (mandatory): Selenium Grid version. Details are fetching from matrix [file](tests/build-backward-compatible/selenium-matrix.yml)\n- `$2` (mandatory): Browser major version, multiple values separated by comma. Details are fetching from matrix [file](tests/build-backward-compatible/browser-matrix.yml)\n- `$3` (optional): browser name. If not provided, it will iterate over all the browsers (`chrome`, `edge`, `firefox`)\n- `$4` (optional): Push image to registry. By default, it is `false`. If you want to push the image to the registry, set it to `true` (required Docker login to your namespace done before running the script).\n\nTo set your namespace for the images, you can set the environment variable `NAME` before running the script. For example:\n\n```bash\n$ export NAME=artifactory.yourcompany.com/selenium\n$ ./tests/build-backward-compatible/bootstrap.sh 4.17.0 119,120,123 chrome\n```\n\nAfter running the script, you will see list images with a full tag to pin specific Grid and browser version following [Tagging Conventions](https://github.com/SeleniumHQ/docker-selenium/wiki/Tagging-Convention)\n\n---\n\n## Upgrade browser version in the images\n\nSelenium server, browser and driver are pre-installed in the image. In case you would like to remain on the same Selenium version and just upgrade the browser and its driver to the latest. You can follow below steps\n\nClone the repo and from the project directory root you can upgrade by running:\n\n```bash\n$ VERSION=$EXPECTED_SELENIUM_VERSION make chrome_upgrade_version\n```\nFor example: `VERSION=4.16.1 make chrome_upgrade_version`\n\nThe new image has tag `$VERSION_YYYYMMDD` where `YYYYMMDD` is the current date.\n\n```bash\n$ VERSION=$SELENIUM_VERSION make firefox_upgrade_version\n```\n\n```bash\n$ VERSION=$SELENIUM_VERSION make edge_upgrade_version\n```\n\nYou can refer to detail commands in the [Makefile](Makefile) file.\n\n---\n\n## Waiting for the Grid to be ready\n\nIt is a good practice to check first if the Grid is up and ready to receive requests, this can be done by checking the `/wd/hub/status` endpoint.\n\nA Grid that is ready, composed of a hub and two nodes, could look like this:\n\n```json\n{\n  \"value\": {\n    \"ready\": true,\n    \"message\": \"Selenium Grid ready.\",\n    \"nodes\": [\n      {\n        \"id\": \"6c0a2c59-7e99-469d-bbfc-313dc638797c\",\n        \"uri\": \"http:\\u002f\\u002f172.19.0.3:5555\",\n        \"maxSessions\": 4,\n        \"stereotypes\": [\n          {\n            \"capabilities\": {\n              \"browserName\": \"firefox\"\n            },\n            \"count\": 4\n          }\n        ],\n        \"sessions\": [\n        ]\n      },\n      {\n        \"id\": \"26af3363-a0d8-4bd6-a854-2c7497ed64a4\",\n        \"uri\": \"http:\\u002f\\u002f172.19.0.4:5555\",\n        \"maxSessions\": 4,\n        \"stereotypes\": [\n          {\n            \"capabilities\": {\n              \"browserName\": \"chrome\"\n            },\n            \"count\": 4\n          }\n        ],\n        \"sessions\": [\n        ]\n      }\n    ]\n  }\n}\n```\n\nThe `\"ready\": true` value indicates that the Grid is ready to receive requests. This status can be polled through a\nscript before running any test, or it can be added as a [HEALTHCHECK](https://docs.docker.com/engine/reference/run/#healthcheck)\nwhen the docker container is started.\n\n### Adding a [HEALTHCHECK](https://docs.docker.com/engine/reference/run/#healthcheck) to the Grid\n\nThe script [check-grid.sh](Base/check-grid.sh), which is included in the images, can be used to poll the Grid status.\n\nThis example checks the status of the Grid every 15 seconds, it has a timeout of 30 seconds when the check is done,\nand it retries up to 5 times until the container is marked as unhealthy. Please use adjusted values to fit your needs,\n(if needed) replace the `--host` and `--port` parameters for the ones used in your environment.\n\n``` bash\n$ docker network create grid\n$ docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub \\\n  --health-cmd='/opt/bin/check-grid.sh --host 0.0.0.0 --port 4444' \\\n  --health-interval=15s --health-timeout=30s --health-retries=5 \\\n  selenium/hub:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n    selenium/node-chrome:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n    selenium/node-edge:4.29.0-20250303\n$ docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n    selenium/node-firefox:4.29.0-20250303\n\n```\n**Note:** The `\\` line delimiter won't work on Windows-based terminals, try either `^` or a backtick.\n\nThe container health status can be checked by doing `docker ps` and verifying the `(healthy)|(unhealthy)` status or by\ninspecting it in the following way:\n\n```bash\n$ docker inspect --format='{{json .State.Health.Status}}' selenium-hub\n\"healthy\"\n```\n\n### Using a bash script to wait for the Grid\n\nA common problem known in docker is that a running container does not always mean that the application inside it is ready.\nA simple way to tackle this is by using a \"wait-for-it\" script, more information can be seen [here](https://docs.docker.com/compose/startup-order/).\n\nThe following script is an example of how this can be done using bash, but the same principle applies if you want to do this with the programming language used to write the tests.\nIn the example below, the script will poll the status endpoint every second. If the grid does not become ready within 30 seconds, the script will exit with an error code.\n\n```bash\n#!/bin/bash\n# wait-for-grid.sh\n\nset -e\nurl=\"http://localhost:4444/wd/hub/status\"\nwait_interval_in_seconds=1\nmax_wait_time_in_seconds=30\nend_time=$((SECONDS + max_wait_time_in_seconds))\ntime_left=$max_wait_time_in_seconds\n\nwhile [ $SECONDS -lt $end_time ]; do\n    response=$(curl -sL \"$url\" | jq -r '.value.ready')\n    if [ -n \"$response\"  ]  \u0026\u0026 [ \"$response\" ]; then\n        echo \"Selenium Grid is up - executing tests\"\n        break\n    else\n        echo \"Waiting for the Grid. Sleeping for $wait_interval_in_seconds second(s). $time_left seconds left until timeout.\"\n        sleep $wait_interval_in_seconds\n        time_left=$((time_left - wait_interval_in_seconds))\n    fi\ndone\n\nif [ $SECONDS -ge $end_time ]; then\n    echo \"Timeout: The Grid was not started within $max_wait_time_in_seconds seconds.\"\n    exit 1\nfi\n```\n\u003e Will require `jq` installed via `apt-get`, else the script will keep printing `Waiting` without completing the execution.\n\n**Note:** If needed, replace `localhost` and `4444` for the correct values in your environment. Also, this script is polling indefinitely, you might want\nto tweak it and establish a timeout.\n\nLet's say that the normal command to execute your tests is `mvn clean test`. Here is a way to use the above script and execute your tests:\n\n```bash\n$ ./wait-for-grid.sh \u0026\u0026 mvn clean test\n```\n\nLike this, the script will poll until the Grid is ready, and then your tests will start.\n\n___\n\n## Install certificates for Chromium-based browsers\n\nBy default, the based image is installed `libnss3-tools` and initializes `/home/seluser/.pki/nssdb`,\nso you are able to add your certs with rootless.\nIf you need to install custom certificates, CA, intermediate CA,\nor client certificates (for example, enterprise internal CA)\nyou can create your own docker image from selenium node image.\nThe Chromium-based browser uses `nssdb` as a certificate store.\nYou can then install all required internal certificates in your Dockerfile like this:\n\nThere is a utility script packaged in the image that can be used to add your certificates to the `nssdb` store and the bundle CA.\nThe script is `/opt/bin/add-cert-helper.sh`.\n\n- Create a Dockerfile that uses the selenium node image as a base and copies the script to the container, and executes it.\nFor example, [Dockerfile](tests/customCACert/Dockerfile)\n\n- If you have to create a set of different certificates and node images. You can create a bootstrap script to do that in one-shot.\nFor example, [bootstrap.sh](tests/customCACert/bootstrap.sh)\n\nThe above example can be tested with the following command:\n\n```bash\nmake test_custom_ca_cert\n# ./tests/customCACert/bootstrap.sh\n```\n\nYou can find more information [here](https://chromium.googlesource.com/chromium/src/+/master/docs/linux/cert_management.md)\n\nThis way the certificates will be installed and the node will start automatically as before.\n___\n\n## Alternative method: Add certificates to existing Selenium based images for browsers\n\nAs an alternative, you can add your certificate files to existing Selenium images. This practical example\nassumes you have a known image to use as a build image and have a way to publish new images to your local\ndocker registry.\n\nThis example uses a RedHat-based distro as a build image (Rocky Linux) but it can be *any* Linux image of your choice.\nPlease note that build instruction will vary between distributions. You can check the instructions for Ubuntu\nin the previous example.\n\nThe example also assumes your internal CA is already in */etc/pki/ca-trust/source/anchors/YOUR_CA.pem*,\nthe default location for Rocky Linux. Alternatively, you can also provide these files from your host and \ncopy them into the build image.\n\nFor Chrome and Edge browsers, the recipe is the same, just adapt the image name (node-chrome or node-edge):\n```\n# Get a standard image for creating nssdb file\nFROM rockylinux:8.6 as build\nRUN yum install -y nss-tools\nRUN mkdir -p -m755 /seluser/.pki/nssdb \\\n    \u0026\u0026 certutil -d sql:/seluser/.pki/nssdb -N --empty-password \\\n    \u0026\u0026 certutil -d sql:/seluser/.pki/nssdb -A -t \"C,,\" -n YOUR_CA -i /etc/pki/ca-trust/source/anchors/YOUR_CA.pem \\\n    \u0026\u0026 chown -R 1200:1201 /seluser\n\n# Start from Selenium image and add relevant files from build image\nFROM selenium/node-chrome:4.29.0-20250303\nUSER root\nCOPY --from=build /seluser/ /home/seluser/\nUSER seluser\n```\n\nExample for Firefox:\n```\n# Get a standard image for working on\nFROM rockylinux:8.6 as build\nRUN mkdir -p \"/distribution\" \"/certs\" \u0026\u0026 \\\n    cp /etc/pki/ca-trust/source/anchors/YOUR_CA*.pem /certs/ \u0026\u0026 \\\n    echo '{ \"policies\": { \"Certificates\": { \"Install\": [\"/opt/firefox-latest/YOUR_CA.pem\"] }} }' \u003e\"/distribution/policies.json\"\n\n# Start from Selenium image and add relevant files from build image\nFROM selenium/node-firefox:4.29.0-20250303\nUSER root\nCOPY --from=build /certs /opt/firefox-latest\nCOPY --from=build /distribution /opt/firefox-latest/distribution\nUSER seluser\n```\n___\n\n## Debugging\n\nThis project uses [x11vnc](https://github.com/LibVNC/x11vnc) as a VNC server to allow users to inspect what is happening\ninside the container. Users can connect to this server in two ways:\n\n### Using a VNC client\n\nThe VNC server is listening to port 5900, you can use a VNC client and connect to it. Feel free to map port 5900 to \nany free external port that you wish.\n\nThe internal 5900 port remains the same because that is the configured port for the VNC server running inside the container. \nYou can override it with the `SE_VNC_PORT` environment variable in case you want to use `--net=host`.\n\nHere is an example with the standalone images, the same concept applies to the node images.\n``` bash\n$ docker run -d -p 4444:4444 -p 5900:5900 --shm-size=\"2g\" selenium/standalone-chrome:4.29.0-20250303\n$ docker run -d -p 4445:4444 -p 5901:5900 --shm-size=\"2g\" selenium/standalone-edge:4.29.0-20250303\n$ docker run -d -p 4446:4444 -p 5902:5900 --shm-size=\"2g\" selenium/standalone-firefox:4.29.0-20250303\n```\n\nThen, you would use in your VNC client:\n- Port 5900 to connect to the Chrome container\n- Port 5901 to connect to the Edge container\n- Port 5902 to connect to the Firefox container\n\nIf you get a prompt asking for a password, it is: `secret`. If you wish to change this, \nyou can set the environment variable `SE_VNC_PASSWORD`.\n\nIf you want to run VNC without password authentication you can set the environment variable `SE_VNC_NO_PASSWORD=true`.\n\nIf you want to run VNC in view-only mode you can set the environment variable `SE_VNC_VIEW_ONLY=true`.\n\nIf you want to modify the open file descriptor limit for the VNC server process you can set the environment variable `SE_VNC_ULIMIT=4096`.\n\n### Using your browser (no VNC client is needed)\n\nThis project uses [noVNC](https://github.com/novnc/noVNC) to allow users to inspect visually container activity with\ntheir browser. This might come in handy if you cannot install a VNC client on your machine. Port 7900 is used to start\nnoVNC, so you will need to connect to that port with your browser.\n\nSimilarly to the previous section, feel free to map port 7900 to any free external port that you wish.\nYou can also override it with the `SE_NO_VNC_PORT` environment variable in case you want to use `--net=host`.\n\nHere is an example with the standalone images, the same concept applies to the node images.\n``` bash\n$ docker run -d -p 4444:4444 -p 7900:7900 --shm-size=\"2g\" selenium/standalone-chrome:4.29.0-20250303\n$ docker run -d -p 4445:4444 -p 7901:7900 --shm-size=\"2g\" selenium/standalone-edge:4.29.0-20250303\n$ docker run -d -p 4446:4444 -p 7902:7900 --shm-size=\"2g\" selenium/standalone-firefox:4.29.0-20250303\n```\n\nThen, you would use in your browser:\n- http://localhost:7900/ to connect to the Chrome container\n- http://localhost:7901/ to connect to the Edge container\n- http://localhost:7902/ to connect to the Firefox container\n\nIf you get a prompt asking for a password, it is: `secret`.\n\n### Disabling VNC\nIf You are running low on resources, or simply don't need to inspect running sessions, it is possible to not run VNC at all.\nJust set \n```SE_START_VNC=false```\nenvironment variable on the grid startup.\n\n___\n\n## Tracing in Grid\n\nIn order to enable tracing in the Selenium Grid container, the following commands can be executed:\n\n```bash\ndocker network create grid\ndocker run -d -p 16686:16686 -p 4317:4317 --net grid --name jaeger jaegertracing/all-in-one:1.54\ndocker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.29.0-20250303\ndocker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n\t-e SE_ENABLE_TRACING=true \\\n\t-e SE_OTEL_TRACES_EXPORTER=otlp \\\n\t-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \\\n    selenium/node-chrome:4.29.0-20250303\ndocker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n\t-e SE_ENABLE_TRACING=true \\\n\t-e SE_OTEL_TRACES_EXPORTER=otlp \\\n\t-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \\\n    selenium/node-edge:4.29.0-20250303\ndocker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \\\n    --shm-size=\"2g\" \\\n\t-e SE_ENABLE_TRACING=true \\\n\t-e SE_OTEL_TRACES_EXPORTER=otlp \\\n\t-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \\\n    selenium/node-firefox:4.29.0-20250303\n```\n\nYou can also refer to the below docker compose yaml files to be able to start a simple grid (or) a dynamic grid.\n\n* Simple Grid [v3 yaml file](docker-compose-v3-tracing.yml)\n* Simple Grid [v2 yaml file](docker-compose-v2-tracing.yml)\n* Dynamic Grid [v3 yaml file](docker-compose-v3-full-grid-tracing.yml)\n\nYou can view the [Jaeger UI](http://localhost:16686/) and trace your request.\n\nBy default, the tracing is enabled in Grid components. Without trace exporter endpoint, it will look up a local instance e.g. `localhost/[0:0:0:0:0:0:0:1]:4117`.\nIn container logs you can see few lines like below:\n\n```bash\nERROR (ThrottlingLogger.dolog) Failed to export spans.\n  The request could not be executed. Error message: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4117\n  java.net.ConnectException: Failed to connect to localhost/[0:0:0:0:0:0:0:1]:4317 \nat okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297)\nat okhttp3.internal.connection. ExchangeFinder.findConnection (Exchangefinder.kt: 226)\nat okhttp3.internal.connection.okhttps.internal.connection.RealConnection.connect(RealConnection.kt:207)\n```\n\nIn this case, just simply set `SE_ENABLE_TRACING=false` to all components container to disable tracing (each component exports its own traces).\n\n___\n\n## Troubleshooting\n\nAll output gets sent to stdout, so it can be inspected by running:\n``` bash\n$ docker logs -f \u003ccontainer-id|container-name\u003e\n```\n\nYou can increase the log output by passing environment variable to the containers:\n```\nSE_OPTS=\"--log-level FINE\"\n```\n\n### `--shm-size=\"2g\"`\n\nWhy is `--shm-size 2g` necessary?\n\u003e This is a known workaround to avoid the browser crashing inside a docker container, here are the documented issues for\n[Chrome](https://code.google.com/p/chromium/issues/detail?id=519952) and [Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1338771#c10).\nThe shm size of 2gb is arbitrary but known to work well, your specific use case might need a different value, it is recommended\nto tune this value according to your needs.\n\n\n### Headless\n\nIf you see the following selenium exceptions:\n\n`Message: invalid argument: can't kill an exited process`\n\nor\n\n`Message: unknown error: Chrome failed to start: exited abnormally`\n\nor\n\n` [DriverServiceSessionFactory.apply] - Error while creating session with the driver service. Stopping driver service: java.util.concurrent.TimeoutException`\n\nThe reason _might_ be that you've set the `SE_START_XVFB` environment variable to `false`, but forgot to \nactually run Firefox, Chrome or Edge in headless mode.\n\n### Mounting volumes to retrieve downloaded files\n\nA common scenario is mounting a volume to the browser \ncontainer in order to retrieve downloaded files. This\nworks well in Windows and macOS but not without \nworkarounds in Linux. For more details, check this\nwell-documented [issue](https://github.com/SeleniumHQ/docker-selenium/issues/1095).\n\nFor example, while using Linux, you might be starting a\ncontainer in the following way:\n\n```bash\ndocker run -d -p 4444:4444 --shm-size=\"2g\" \\\n  -v /home/ubuntu/files:/home/seluser/Downloads \\\n  selenium/standalone-chrome:4.29.0-20250303\n```\n\nThat will mount the host `/home/ubuntu/files` directory\nto the `/home/seluser/Downloads` inside the container\n(default browser's downloads directory). The\nproblem happens because the volume will be mounted as\n`root`; therefore, the browser cannot write a file to\nthat directory because it is running under the user \n`seluser`. This happens because that is how Docker mounts\nvolumes in Linux, more details in this [issue](https://github.com/moby/moby/issues/2259).\n\nA workaround for this is to create a directory on the\nhost and change its permissions **before mounting the volume**. \nDepending on your user permissions, you might need to use \n`sudo` for some of these commands:\n\n```bash\nmkdir /home/ubuntu/files\nchown 1200:1201 /home/ubuntu/files\n```\n\nAfter doing this, you should be able to download files\nto the mounted directory. If you have a better workaround,\nplease send us a pull request!\n\n### Mounting volumes to retrieve video files\n\nSimilar to mount volumes to retrieve downloaded files. For video files, you might need to do the same\n\n```bash\nmkdir /tmp/videos\nchown 1200:1201 /tmp/videos\n```\n\n## Stargazers over time\n[![Stargazers over time](https://starchart.cc/SeleniumHQ/docker-selenium.svg?variant=adaptive)](https://starchart.cc/SeleniumHQ/docker-selenium)\n","funding_links":["https://opencollective.com/selenium"],"categories":["HarmonyOS","Shell","Don't forget to give a :star: to make the project popular","selenium-server","selenium","Resources"],"sub_categories":["Windows Manager","Containers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSeleniumHQ%2Fdocker-selenium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSeleniumHQ%2Fdocker-selenium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSeleniumHQ%2Fdocker-selenium/lists"}