Dakota has tested all of the features of her application in her local development environment. She is proud to push the app to their team’s testing environment for QA to look at. Within hours, QA is reporting that none of the pages are loading. She looks at their server logs and sees cryptic error messages coming from a specific Linux package that is out of date. “Hmmm”, she wonders. “Why didn’t I see this in my local environment?”
This type of story is all too common in software development. An application or feature works in one environment but not another. Often, this is caused by differences in dependencies – external files and programs that are not a part of the application but are used by it.
DevOps relies upon containerization to solve this issue. Containerization is a form of virtualization in which users create virtual environments called containers. Like virtual machines (VMs), containers include instances of applications as well as their dependencies. This makes them a convenient solution to help applications behave consistently when moving through the deployment pipeline.
But couldn’t we just use VMs to also solve this problem?
Unlike VMs, containers do not include their own operating system. Instead, they share the operating system of the host machine. The lack of their own operating system makes containers smaller and faster to spin up than VMs. It would be inconvenient to re-create a virtual machine whenever changes to an application or its dependencies are made. Containers, on the other hand, can be started in only seconds.
Additionally, since containers do not need their own operating system, they use less physical resources than virtual machines. This allows many more containers to be run than VMs, leading to even more efficient scaling.
The technology for containerization has been around for decades. However, it did not become widespread until 2013 with the release of Docker. Docker provided a simple interface for developers to create and run containers. Today, there are a handful of containerization tools that are used in addition to Docker.
- Take a look at the GIF for this exercise labeled “Without Containerization”. We see an application moving through different environments in a deployment pipeline. Each environment has a virtual machine that runs our application. However, each step needs to be paused for dependencies to be upgraded.
- Now, take a look at the GIF labeled “With Containerization”. Our application can move seamlessly between the different stages in our pipeline. It takes only seconds to deploy the container, and we are guaranteed to have a consistent environment in which it runs.
In the next lesson, we’ll look at how virtualization and containerization enable automation of time consuming practices.