Test automation is the secret to DevOps success and is essential in the world of continuous deployment and short deployment cycles. To achieve high speed and agility, it is important to automate our testing processes and configure them to run automatically to get automated feedback on each code commit. With TestProject you can easily integrate into your CI/CD workflow with their rich API swagger and the most popular DevOps tools, including Jenkins, Azure DevOps, and Docker! 🐳🚀
In this tutorial, we are going to focus on Docker: What is Docker, how do we set up a Docker environment, and how can we benefit from TestProject Agents in Docker container? And more! Let’s get started with this best Docker tutorial to accelerate your automation testing! 🐳👉
Table of Contents
- You’re here → Introduction to Docker & Docker Desktop
- Introduction to TestProject and TestProject Agent in Docker
- Running TestProject Agent inside Docker Container
- Why Do I Need TestProject Agents Running Inside Docker Containers?
- Setting up TestProject Agent in Docker
- TestProject in Docker Reports and Dashboards
- Conclusion
- [Webinar Recording] Accelerate Your Test Automation using TestProject & Docker
Introduction to Docker & Docker Desktop
Why Docker?
Gone are the days when applications & their dependencies needed to be set up on different physical systems for developing, testing & making them available for the end-users. The introduction of virtualizing hardware inside the same system broke away from these constraints that we had been locked into. But that also came at a price and many resources left untouched finally gave in to the concept of containerization.
In layman’s terms, it’s simply the process of packing the software & its dependencies so the application runs quickly and reliably from one computing environment to another for development, shipment, and deployment.
Build, Ship & Share
Docker is the de facto standard to build, run and share containerized apps – from desktop to the cloud. Docker uses a client-server architecture in the following way:
- The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers.
- The Docker client and daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon.
- The Docker client and daemon communicate using a REST API, over UNIX sockets or a network interface.
Components of Docker
Docker has the following components:
- Docker for Mac − It allows one to run Docker containers on the Mac OS.
- Docker for Linux − It allows one to run Docker containers on the Linux OS.
- Docker for Windows − It allows one to run Docker containers on the Windows OS.
- Docker Engine − It is used for building Docker images and creating Docker containers.
- Docker Hub − This is the registry that is used to host various Docker images.
- Docker Compose − This is used to define applications using multiple Docker containers.
Docker Objects
When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. This section is a brief overview of some of those objects:
- Images: An image is a read-only template with instructions for creating a Docker container. You can create your own image, using a Dockerfile with a simple syntax for defining the steps needed to create the image and run it, or build an image based on another image, with some additional customization.
- Containers: A container is a runnable instance of an image. You can create, start, stop, move, or delete a container using the Docker API or CLI. You can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.
- Services: Services allow you to scale containers across multiple Docker daemons, which all work together as a swarm with multiple managers and workers.
Docker Hub
A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry.
Docker Compose
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. Compose is great for development, testing, and staging environments, as well as CI workflows. We will be leveraging Docker Compose towards the end of this tutorial where we will be starting a TestProject agent with headless Chrome and Firefox browsers.
Features of Docker
- Docker reduces the size of the development environment by providing a smaller footprint of the operating system via docker containers.
- With docker containers, it becomes easier for teams across different units, such as development, QA, and Operations to work seamlessly across applications.
- You can deploy containers anywhere, on any physical and virtual machines, and even in the cloud.
- Since Docker containers are relatively lightweight, they are easily scalable.
Setting up a Docker Environment
Follow the instructions appropriate for your operating system to download and install Docker Desktop:
- Docker Desktop for Mac: https://docs.docker.com/docker-for-mac/install/
- Docker Desktop for Windows: https://docs.docker.com/docker-for-windows/install/
- Docker For Ubuntu: https://docs.docker.com/engine/install/ubuntu/
After you’ve successfully installed Docker Desktop, you can verify the Docker version by clicking on whale-icon on the top left of the screen and selecting “About Docker Desktop”.
Open a terminal and run docker –version to check the version of Docker installed on your machine.
- $ docker version
Test that your installation works by running the hello-world Docker image:
- $ docker run hello-world
FAQs
- What is a Docker Compose? Docker Compose is a tool that was developed to help define and share multiple containers applications. With Docker Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.
- What’s the difference between Docker commands and Docker Compose? The difference between Docker and Docker Compose is simple: docker commands are focused on only one container (or image) at once while docker compose manages several docker containers.
- What is the difference between Docker files and Docker Compose? A Docker file is a simple text file that contains the commands a user could call to assemble a docker image whereas Docker Compose is a tool for defining and running multiple docker container applications. Docker Compose defines the services that make up your app in docker-compose.
Now we are all set and familiar with Docker! Next up, we will learn where TestProject comes into the picture, what are the benefits to having TestProject Agents running inside Docker containers and how to set it up!
👉🐳 Go ahead to the next chapter!