logo logo

The Ultimate Docker Tutorial for Automation Testing

The Ultimate Docker Tutorial for Automation Testing using TestProject

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! 🐳👉

TestProject Test Automation Platform

Table of Contents 

  1. You’re here → Introduction to Docker & Docker Desktop
    1. Why Docker?
    2. Build, Ship & Share
    3. Components of Docker
    4. Docker Objects
    5. Docker Hub
    6. Features of Docker
    7. Docker Compose
    8. Setting up a Docker Environment
    9. FAQs
  2. Introduction to TestProject and TestProject Agent in Docker
    1. Why TestProject?
    2. Getting Started with TestProject
    3. TestProject Agent
    4. TestProject Architecture
    5. Create Your First Test with TestProject
  3. Running TestProject Agent inside Docker Container

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.  

Containerized Applications

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.

Docker Architecture

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 objects

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 Hub

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.

Docker Compose

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:

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”.

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


  1. 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.

  2. 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.

  3. 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

About the author

Ajeet Singh Raina
Ajeet Singh Raina is a Docker Captain Docker Bangalore Community Leader, the largest Docker Meetup in the world with nearly 10,100+ members. He won “The Tip of Captain’s Hat Award” in Dockercon 2019 which happened in San Francisco. He bagged Docker Community Award early Jan 2020. He recently joined “ARM Innovator Program” club which includes 25 industry-leading experts and founders committed to extending ARM architecture & sharing their knowledge in IoT, AI & Security.
He is a prolific blogger, sharing Docker & Kubernetes contents on his blog Collabnix, which had over a million views in 2019. He had already authored 200+ blogs around Docker, Kubernetes & DevOps tools. He is a frequent speaker and conduct virtual events globally. His Meetups are more like mini-conferences, commonly exceeding hundreds of RSVPs and involve hands-on workshop and training content that he and his docker community have developed. Ajeet also helped to organize and/or speak at more than 30+ events over the past year.
You can reach out to him via TwitterLinkedIn & Slack. You can follow his work at GITHUB.

Leave a Reply