Reading Time 2 minutes
To Docker or not to Docker, that is the question. Docker is an open source project but you already know that, right? It is used to deploy containers which can contain software and applications. I assume you also know that? The biggest question here is why you should use it? Or better yet, what value can it bring to testing?
Docker, what is it?
Docker is a tool which allows you to deploy containers. A container can contain a version of an OS, application and software. Let’s take a second to understand why this is even important. In other words, so what if Docker does this. Just what problem does Docker solve?
Have you ever come across the scenario below:
Developer: Hey, run the code below. QA: It does not run on my machine :( Developer: Well, it works on mine!
The above scenario can be caused by external dependencies, libraries, humans etc. Containers on the other hand actually contain everything that you need to run it. This means as long as both the Developer and the QA have an instance of Docker running, they both should be able to run the container.
Let’s examine the structure of a Docker image in more details, examine the image below:
The image above describes the difference between a VM and a Container. A VM contains the full OS system, applications, software etc. However, it is not always possible to share VM’s and have them reliable run on more than one machine. This can be caused by reasons described above. The Docker container however run’s on a Docker Engine. This increases the reliability of the container running.
With all of this said, why should you bother learning and running Docker containers, especially for test?
Why should you use it?
Docker for testing, here are the advantages:
* It’s free
The free part makes sense, but what’s the deal with the ‘Environment’?
Let’s take a step back for a moment. When running tests against an environment, you are subject to the stability of that environment. This means if your environment is unstable, your tests will fail. This is clearly not the fault of your tests. What if you can control the environments? What if you can ensure your environments are more stable?
With Docker, you have that option. Using Docker, you will be able to run your environments in one container with your tests running in another. Learning to use and run containers will give you more control over your testing environments.
What do you think, do you have any other thoughts on this?