Selenium Grid 4 Setup with Docker — Complete Guide (2026)
Stand up a scalable Selenium Grid 4 in under 10 minutes using Docker Compose. Includes hub-node topology, autoscaling via Kubernetes, session queue tuning, and a full CI recipe.

Last updated 2026-07-20 · 11 min read · By Avinash Kamble, reviewed by Priyanka G.
Selenium Grid 4 is a full rewrite — new event bus, session queue, and Kubernetes-native scaling. If you last set up a grid on 3.x, everything you know about JSON wire protocol and static node registration is gone. This guide gets you to a green Chrome + Firefox grid in 10 minutes and shows the autoscale pattern we use in production.
Key takeaways
- The 3 grid topologies (Standalone, Hub-Node, Fully Distributed).
- A copy-paste
docker-compose.ymlfor hub + Chrome + Firefox.- Session queue tuning that eliminates the "no free slots" flakes.
- Kubernetes autoscaling via KEDA + the Selenium chart.
1. Pick a topology
| Topology | When to use |
|---|---|
| Standalone | Local dev, 1 machine, no scale. |
| Hub & Node | Small teams, <100 parallel sessions. |
| Fully Distributed | Enterprise, split router / distributor / queue / event-bus / session-map. |
2. Docker Compose for hub + 2 browser nodes
services:
selenium-hub:
image: selenium/hub:4.24
ports: ["4442:4442", "4443:4443", "4444:4444"]
chrome:
image: selenium/node-chrome:4.24
shm_size: 2gb
depends_on: [selenium-hub]
environment:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443
SE_NODE_MAX_SESSIONS: 4
firefox:
image: selenium/node-firefox:4.24
shm_size: 2gb
depends_on: [selenium-hub]
environment:
SE_EVENT_BUS_HOST: selenium-hub
SE_EVENT_BUS_PUBLISH_PORT: 4442
SE_EVENT_BUS_SUBSCRIBE_PORT: 4443Point your tests at http://localhost:4444/wd/hub. Grid UI: http://localhost:4444/ui.
3. Session queue tuning
Set SE_SESSION_REQUEST_TIMEOUT=300 and SE_SESSION_RETRY_INTERVAL=5 to eliminate the "no free slots" flakes when CI bursts. Also raise SE_NODE_MAX_SESSIONS to (cpu_count × 1.5) — most teams under-provision here.
4. Kubernetes autoscaling
Use the official Selenium Helm chart with KEDA. It scales browser pods against the session queue length, so idle costs stay low. See the Selenium locators cheat sheet for the test-side complement, and explicit / implicit / fluent waits if you are seeing timeout errors under load.
Frequently asked questions
1.Do I still need a Selenium Grid in the Playwright era?
2.Docker or Kubernetes?
3.How do I record videos?
4.Chromedriver mismatch errors?
Practice these questions
Work through 300+ Selenium questions with Java code snippets, Selenium 4, Grid, framework patterns and CI/CD scenarios.
Was this article helpful?
More from Selenium Advanced (Grid, Docker)
Selenium Grid, Docker, parallelism, CDP, cloud runs.
Keep building your QA edge
Pillar guides- Playwright PillarPlaywright interview questions300 Playwright Q&A, framework design, and migration guides.
- XPath & CSS Selector GeneratorXPath and CSS selector generatorInteractive locator generator for Playwright, Selenium and Cypress — with Page Object export.
- Automation QA Engineer Roleexplore this role in depthAutomation QA Engineer job scope, tools, salary, and hiring pipeline.
- QA Skills Hubmap out what to learn nextStructured skill tracks — Selenium, Playwright, Cypress, API, JMeter, SQL, Java, Python for testers.
Practice these questions live
Rehearse with an AI QA interviewer that scores your answers in real time.
Continue reading

Playwright Locator Best Practices (2026) — The Only Guide You Need
11 min read
How to Migrate a Postman Collection to Playwright API Tests (2026 Guide)
12 min read
Why Every QA Engineer Must Master CI/CD Pipelines in 2026 (Or Risk Obsolescence)
12 min readRelated concepts, tools & standards around Automation Testing
A quick reference of the people, companies, frameworks and technologies most often mentioned alongside Automation Testing in real QA teams — useful when you're mapping a learning path, preparing for interviews, or scoping a new project.
Join the QA Community
Connect with fellow testers, share job leads, and get career advice.
Stop Reinventing the Wheel. Upgrade Your QA Arsenal.
Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.
- Ready-to-use testing strategy templates
- Advanced API & UI automation guides
- ⏱️ Save 10+ hours a week on test planning
Discussion
Ask a question, share your experience, or correct us. Be kind — real people are reading.