Leveraging Docker to ease the portability and scalability process of setting up Selenium GRID

Leveraging Docker to ease the portability and scalability process of setting up Selenium GRID 

What is the best option for achieving Selenium test scalability when using Selenium Grid

Let us quickly understand what is Selenium Grid

Selenium-Grid allows you to run your tests on different machines against different browsers in parallel.

That is, running multiple tests at the same time against different machines running different browsers and operating systems.

Essentially, Selenium-Grid support distributed test execution. It allows for running your tests in a distributed test execution environment.


Can we leverage Docker for implementing Selenium Grid ? Answer is Yes. 

What are other options for implementing Selenium Grid

Option 1:

Consider running multiple actual(physical) machines and then running selenium tests on it in parallel using Selenium GRID. This is old school and legacy – no one is probably using it currently

Option 2:

Consider running multiple Virtual machines and then running selenium tests on it in parallel using Selenium Grid. Most of the organizations are currently using this option for their Selenium Grid implementations. Cloud implementations also are using some form of a VM

Option 3: Leveraging Docker for implementing Selenium Grid

In this option, we run multiple Containers(Docker) and then run selenium tests on it in parallel using Selenium Grid. This looks the best possible option in today’s scenario

To see how is this the best option, we would have to understand what docker is and what is the difference between docker and a VM and advantages of containers over a VM.

What is Docker

Docker is the company driving the container movement and the only container platform provider to address every application across the hybrid cloud. It is also the name of a software handling Containers on Linux and the name of the software which handles containers on Windows. (Reference

What is container

The adjacent image is from the following page

To explain what is container let us look at a situation where two applications with same name with the same folder structure are running on the same operating system say Windows. Applications may be in conflict with each other. When we run our application on the computer we stand a chance to have it conflict with everything else that is running on the computer.

With a container we achieve a higher level of isolation.

Each container has its own

  1. file system,
  2. its own registry,
  3. its own network layer with its own published ports,
  4. and of course its own memory space –
  5. kind of like a virtual machine, just without the fat guest operating system.
  6. The container is also almost instant on, when you run a container it doesn’t have to perform all kind of initialization’s like a normal computer.

A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows based apps, containerized software will always run the same, regardless of the environment. Containers isolate software from its surroundings, for example differences between development and staging environments and help reduce conflicts between teams running different software on the same infrastructure (reference )

Difference between Virtual Machines and Containers

VM’s and Containers primary difference is in the way the virtualization works. VM virtualizes the hardware, thus allowing multiple OS instances to run on a single hardware machine. Where as containers provide a way to virtualize an OS in order for multiple workloads to run on a single OS instance.

This also helps in increased speed, agility and portability for a container. We can also run many more containers in a single machine then we can run a VM


As is clear there is a distinct advantage of using container over VM’s

Hence The best, most agile, most cost effective, fastest and easiest option is Option 3, which is leveraging docker for Selenium Grid.

Shivram Mani will take you through a comprehensive 90 minute hands on Labs to not only setup docker images but on how to run selenium grid on them in #seleniumsummit18

Shivram Mani is a Selenium Evangelist and Automation Guru he is also a licensed trainer of CP-SAT and CP-AAT from Agile Testing Alliance.

Do not miss interacting and learning with Shivram in #seleniumsummit18

Leave a Comment