Docker: What is it? How can it be used in Testing?

Everyone's talking about Docker now a days! There are plenty of use cases it has in various different areas of technology domain.

First let's get to know what Docker is!

Docker is a container virtualization technology, which does not require any hypervisor to run it. Strange, isn't it? Well, not really… here is how it works!

Docker relies on Linux Containers (a.k.a. LXC), which is a pretty old implementation of container technology. LXC uses two of the Linux Kernel capabilities:

i) Cgroups
ii) Namespaces

Cgroups enables the system resource allocation, isolation; such as Memory and CPU etc. while Namespaces let each of the container to run in an isolated space with its process isolation capability, without interfering with other containers on the same system. The result - You can run large number of containers on your system. The only limiting factor will be your host system's resources!

Now what makes Container Virtualization differ from Virtual Machines or Desktop/Server Virtualization?

There is a big difference… virtual machines are *thicker* in a sense they run an entire Operating System of some type (Windows/Linux etc.) and have a large disk foot print on your storage. The licensing and other factors will further add to the TCO. In comparison, container images are *thinner* as they are minimalist version of Operating System (only Linux as of today) and does not have a large footprint on your disk storage. Another advantage with container is; you can spin-up one in less than 10 mins (if the image is to be downloaded from Docker Hub) and if the image is already cached locally, it will take hardly few seconds to start one.

Isn't it amazing!

So how can we use Docker containers in testing?

I could think of following usecases; however am sure there will lot more…

Usecase #1: To create dedicated test environment for everyone in your team
Use Dockerfile to define base image, environment and applications you want to run in a container and repeat the same for all your application dependencies such as Database server, Web server et al. Now build containers out of those Dockerfiles and run them all. You can build and run as many containers as your team needs. Happy testing to everyone!

Usecase #2: Test your application in different environments, but on a single host
Production deployments for your application may significantly be different than test environments. Use Docker to spin-up containers each having a different set of configuration parameters, environment variables etc and test your application in that *special kind of* environment. Best part is, you can spin-up, tear-down and change & spin-up this environment as many times as you want.

Usecase #3: Build a scalability test framework
Docker as you now know, has its own resources including filesystem, TCP/IP stack etc. Assume you are testing a Storage array, a NAS box may be. The goal of your testing is to scale-up number of SMB or NFS connections and test your Storage array's performance and stability. Docker's your buddy here! Build some automation to spin-up containers, do mount operations and some IO on remote shares and you are up for the protocol connection scale test.

What other use cases you can think of for Docker in Software Testing?


Happy Testing!

Comments

  1. Hi Shirish,

    Question - Can Docker be used for service virtulization? like Dev Test from CA implements it.

    ReplyDelete
  2. Hi Murali, I think Docker can be used *with* the Service Virtualization applications. Like any other virtualization that you will have in your test environment; Docker containers should be customizable to consume the backend applications provided by the Service Virtualization application. However, one thing to note here; containers can be only Linux as of today; while Windows support will be there in 2016.

    ReplyDelete
  3. got it - thanks Shrish - so what I understand is that rather than creating a stub like CA Dev Test does, we can create an service application so to say.

    ReplyDelete

Post a Comment

Popular posts from this blog

What DevOps mean to QA/Test?

Smart Testing – In the age of Machine Learning!