Tutorial 26 - Selenium 4 Grid With Docker: Install Docker on Windows OS
What you will Learn:
Quick Overview of Selenium 4 Grid Integration with Docker
What is Docker container?
VM and Docker Container are different
Install Docker on Windows
Quick Overview of Selenium 4 Grid Integration with Docker
So far, we have learnt how to setup a selenium hub and node on the same machine. In the real world, the hub and node(s) are setup on a separate machine. A separate machine can be a virtual machine or docker container (we will discuss the difference between them soon). We will now learn about how to integrate Selenium 4 grid with docker. Our hub (selenium server grid) will be setup in one machine and node will be setup in a docker container.
Before we actually start practically learning about Selenium 4 grid and Docker integration, we have to first understand about docker.
What is Docker container?
Let us understand the docker concept by supposing that you have to work on 2 important projects (or apps) in parallel.
#app 1 => has java 7 dependency
#app 2 => has java 8 dependency
Now if you setup java 7 on your machine (for app 1), you will not be able to work on app 2 on the same machine and vice-versa. This is a huge problem. Now what do we do?
The solution to this problem is that we will create 2 separate workspaces. First workspace will have all dependencies related to app#1 and second workspace will have all dependencies related to app#2. In docker terminology, these workspaces are called as containers.
VM and Docker Container are different
Refer the above diagram to understand the difference between virtual machine and docker container.
The left hand side gives a simple overview of VM. So basically, we install Oracle virtualbox on our host operating system. We then setup guest machines on top of this oracle virtualbox. Finally we deploy the apps on these guest operations systems. VM is heavyweight and consumes lot of resources (RAM, cpu etc). Moreover, every VM will have its own kernel. The below figure is a glimpse of guest operating systems in oracle virtualbox. So, in summary, a virtual machine is a complete OS in itself (in the below figure, you can see 4 ubuntu virtual machines). So, in our above example, you can say that, #app1 will be setup in ubuntu1 VM and #app2 will be setup in another ubuntu VM and so on
The right hand side gives an overview of docker container. Docker is lightweight and consumes less resources (docker shares kernel of host OS). We simply have to install docker, create a container and then deploy app#1 inside this container. Similarly, we will create another container and deploy app#2. So these apps are containerized docker applications.
Install Docker on Windows
To install Docker on windows, go to the official page
https://docs.docker.com/docker-for-windows/install/
Click ‘Docker Desktop for Windows’
Double click the above exe to start installation and grant windows admin permissions to proceed.
Ensure that both the checkboxes are selected as shown below
Click Ok and wait for installation to complete
‘Close and restart’ to restart your machine.
After restart, docker icon can be seen on the desktop
Click the icon to start docker
You would see below message at the bottom right hand side tray of your machine. It might take 10-12 mins to start docker on your machine
You might get the below popup
Click Start, this might lead to below popup
If you get below popup, click ‘Continue’
Notice the url in the below popup: https://aka.ms/wsl2kernel
Launch the url https://aka.ms/wsl2kernel
You would be redirected to below link:
Click the above link to download latest package of wsl_update_x64.msi
Double click the package to install
Click Next to start installation
Grant windows admin permissions to proceed.
Click Next
Click Finish
Restart machine.
Click docker icon on your desktop
You might get below popup
Click Start.
Grant windows permissions.
Also Check: Selenium Webdriver Training
Click docker icon once more
You would see ‘Docker engine starting’
After few minutes below comes up
You can start or skip tutorial if you want to.
Let us click ‘Skip tutorial’ to start docker engine, see below
This may take few minutes. If you see above window for more than 5-7 mins or so, close the window and restart the docker desktop icon.
As shown below, when we mouse hover bottom left hand side docker icon, we can see RUNNING which means docker engine is now running
In the next article we would see some of the common problems encountered in docker installation on Windows OS and how to resolve them.
Thank you for reading!
Also Check: Selenium Tutorials