What does Docker have to do with automation? Absolutely nothing! But still the way we automate can be different with the help of Docker containers.
before we start, I would give small introduction to containers and its usages and in next part would explain how to use this for automation with selenium.
Introduction of Docker:
As we know, Docker is all about containers, so now what is a container ?
A standardized unit of software! Everything will be images untill we run, once we run these images on a Docker engine they become containers.
Docker containers are: Standard, lightweight and secure.
Containers Vs. Virtual Machines
Containers are an abstraction at the app layer that packages code and dependencies together. Multiple containers can run on the same machine and share the OS kernel with other containers,
Virtual machines (VMs) are an abstraction of physical hardware turning one server into many servers. The hypervisor allows multiple VMs to run on a single machine
Download docker for windows from here . Installation is fairly simple, just click on Agree and Next button.
After installation create an A/c. it prompts you to login. Login once you can.
After successful installation, type Hyper V on search, you should find a linux VM as shown below.
Note: This will work with latest windows 10 Pro with anniversary update.
If you don’t see, try enabling Hyper V, and enable virtualization from Bios settings.
Basic commands with powershell :
Open Windows powershell with administrator privilage.
Type in: docker version
Type in: docker –help , basically to all the help section.
We shall get our first container image on board with the following command !
Type in : docker pull Ubuntu, you will see the following on your screen.
Till now what we have is just an Ubuntu image, when we run that is when we call it an container.
So now we shall run in interactive mode.
Type in : docker run -it ubuntu bash
You are in Ubuntu, and your first container is up and running, basically using Linux in your Windows.
Run few commands, like ls, have also created a new directory using ‘MKDIR’ which can be seen in the snapshot.
Use of kitematic :
Now using GUI for docker! basically this is an exe file which can be downloaded and all the above mentioned operations can be done from this UI.
Logs of all the actions performed can be seen here as well, below is the snapshot of the actions performed on Ubuntu container.
Infrastructure as code using yml file, Linking between containers.
Use of selenium with containers and run you first test on container!
Develop well-rounded skills to kick off your journey with Docker in our Docker and Containerization training course