The success of software development and product applications depends on DevOps, and DevOps success depends on automation. Automating the testing process and setting it up to run automatically after each code commit is crucial for achieving high speed and agility. Docker does play a big part in automating DevOps, for sure.
To understand this further, it is necessary to first comprehend what Docker is. QA and testing teams also benefit greatly from this. Let’s begin with the fundamentals.
What is docker?
In essence, Docker is a platform that offers virtualization at the operating system level. It provides brand-new machines with its own software libraries configurations, and they communicate with each other very well and makes the overall faster Development cycle with easy and scalable deployments. In docker, everything is based on images which are a standalone executive package of the required software. It has every component needed to deploy, create, and run applications.
What is Docker Hub?
Docker images are kept in a registry. Anyone can utilize Docker Hub, a public registry, and by default, Docker is set up to search there for images. Even running your own private register is an option.
Docker for Testing and Automation
The primary benefit of docker for testers may be the ability to repeatedly start a new test and spin up an image in a docker container. You will have a lot of freedom to test the software in a variety of ways, so you won’t have to worry about the environment.
Limiting the resources on your container can also be used to assess an application’s performance.
It can also be utilized for parallel test executions, cross-browser testing, load tests, etc. It takes a long time to perform tests sequentially, so the docker assists in executing the tests on different containers in parallel.
you can refer our post earlier on using docker for Sonar
How to Install Docker?
Installing and using docker is fairly simple. You have Linux, Mac, or Windows docker installers available as per your requirement
Once downloaded launch the installer
Docker is now ready to run containers on our system using docker. The left pane provides options to toggle between Containers, Images, Volumes, and Dev Environments.
To determine whether Docker is configured properly, run the following line in Command Prompt. The docker version that is currently running on the system is returned.
After installation, the Docker Desktop may run a few docker images. You may either build a Docker image from scratch or use the Docker hub to download a base image that has already been setup and then add to it.
Run the following line on the command prompt to acquire a list of every existing image on the system:
Use the docker pull command to download the appropriate image. Let’s obtain the Selenium image as an illustration. You can look for the necessary image on Docker Hub.
docker pull selenium/standalone-chrome
Run the command “docker images” to see if the download was successful once you’ve downloaded the images. The most recent variations of Chrome and Firefox containers are accessible for use, as can be seen in the example below: The default port that connects to the WebDriver is 4444, and the Chrome and Firefox Containers will be exposed to port 4444.
start the container by running the following command:
docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome
Go to the docker desktop and you will see the container running
Open the browser and navigate to http://localhost:4444/. It reflects Selenium Grid UI, as shown below.