Chapter 1: Intro to Docker
Docker
- Docker is a standalone software that can be installed on any computer to run containerised applications.
- Designed to build, ship and run business critical applications at scale.
- Build and share containers.
- Automate development pipeline.
Containers
- Containerization is an approach of running applications on an OS such that the application is isolated from the rest of the system.
- Applications run using containers and containers are the running instance of an image.
- Containers are lightweight and faster.
- You can control the environment as you create specific images.

Images
- Images are specs used to create containers specifying which services, libraries you need for your container.
- Images are the read-only template/snapshot used to create a Docker container and these Images can be pushed to and pulled from public or private repositories. This is the build component of docker. Images are lightweight, small, and fast as compared to Virtual Machine Images.
Why Docker??
With Docker | Without Docker |
Docker containers can be summarized as wrapping up a piece of software in a complete file system that contains everything it needs to run – code, runtime, system tools, system libraries, etc. | Have to manage each one of those separately |
Manage everything in seconds easily with Spin up Restart Tear Down | Setting up Selenium Grid is also a manual and tedious task. Running multiple commands Management of version |
Chapter 2: Installing Docker on Windows

Installing Docker on Windows
Chapter 3: Setting up Docker
The main components to set up the grid are:

Steps to setup Docker:


To restart the grid, use the following command:
docker-compose restart
To tear down the grid, use the following command:
docker-compose down
Sample YML file:

Chapter 4: Scaling Tests
Tips for tests before we run those using containers:
- The tests considered in the script are independent.
- Each test(s) should have its own instance of a Driver and not shared.
- The test results are saved on the machine which is running the Docker engine and not remote entity like S3.
- Label files/ directories with GUID as tests will run concurrently.
Sample tests:
- Refer the suite from Example
- Specify the type of driver as remote , browser as chrome in the run settings file
Run the tests:

Chapter 5: Scaling Containers
It is all about scaling the clusters using multiple machines and then putting the grid on those clusters. There is a limit to scale the selenium grid on one machine, as it will run out of resources. Hence multiple machines are required.
Docker Swarm
A collection of Docker engines joined into a cluster is called a Swarm. Each machine in a SWARM is called a Node.

SWARM consists of:
Worker Nodes: Worker nodes listen to the task sent by Manager Nodes and then execute them.
Manager Nodes: Manager Nodes also execute tasks alongwith sending tasks to the Worker nodes and maintaining the Desired state of the SWARM
If the desired state has 6 nodes with 3 managers and 3 workers, from which the lead has the Hub and the other nodes have the Firefox containers and if due to some reason any one nodes goes down, then the Docker will detect this and spin up an entirely new node. This is how it makes sure that the Actual state is always matched with Desired State.
Docker Stack
Docker Stack is similar to Docker compose but allows to deploy the services across the SWARM in one command. The same docker-compose.yml file can be used here.

Starting Docker Stack
