Blog, Leadership, Technical Development

Containerization: How to use containers for rapid development

There’s a new technology on the block, and it’s changing the way tech companies test and deploy services: Containerization.
It has led to shorter development cycles and increased testing speed amongst tech companies that have adopted it.

So, what is containerization?

Containerization is a lightweight alternative to full machine virtualization (like images running in VMWare Workstation). It involves encapsulating an application in a container with its own operating environment.
Unlike virtual machines, which run in a completely isolated environment, containers share the same host operating system, but have some resource isolation. This provides the benefits of loading an application onto a virtual machine—the application can be run on any suitable physical machine without any worries about dependencies.
It also leads to portability, robustness, and greater security.
Containerization has gained prominence recently with the open-source platform Docker. Docker is a high-level tool that offers portable deployment across machines, automatic controller build, version control, sharing, and the ability to reuse components.
Docker containers are designed to run on everything from physical computers to virtual machines, bare-metal servers, OpenStack cloud clusters, public instances, and more.
There are other platform alternatives that are utilizing containerization as well, such as CoreOS’s Rocket, Microsoft’s Drawbridge, Canonical’s LXD, and Flockport.

What companies are using Containers already?

A lot of major companies!
Google has been using it for years for their apps and services. Cloud hosting providers like Amazon use it for XaaS (Anything as a Service). And they’re only the tip of the iceberg—many other companies, including both Spotify and Shopify, also use containerization.

Containerization at Spotify

Spotify was one of the early adopters of containerization for internal testing and deployment. One of the ways the company uses containers is to more efficiently deploy the back-end services that power the music-streaming application.
Spotify has a home-grown Docker container orchestration service called Helios through which they control and spin up multiple clusters of containers throughout its data centers.

Containerization at Shopify

Another adopter has been Shopify. Shopify is a commerce solution designed to make creating online stores simple for entrepreneurs.
It is also a large Ruby on Rails application that has undergone massive scaling recently. Their production servers scale to over 8,000 requests per second by spreading the load across 1,700 cores and 6 TB RAM.

Why should I use containers?

Simply put, it simplifies deployment.
Virtual machines can run on any platform with its own configuration on top of the infrastructure. Container services like Docker provide this same capability without the overhead of a virtual machine.
They let you put your environment and configuration into code and deploy it, starting-up in seconds.
The same Docker configuration can also be used in a variety of environments. This decouples infrastructure requirements from the application environment, making it easier to manage code across the pipeline.

It’s easier to manage code across the pipeline.

As code travels from the developer’s machine to production, there are many different environments it has to go through. Each of these may have minor differences. Container services provide a consistent environment for the application from development through production, easing the code development and deployment pipeline.

It provides isolation between applications.

If multiple applications are running on the same machine, it can be difficult to sort out the dependencies and libraries. Also, failure of one can affect others too. With containers, each app works in an isolated environment, free from interference of other apps.

It’s dev-ops friendly, has strong version-control as well as debugging capabilities.

Traditionally, a developer would develop and test an application and then hand it over to dev-ops for deployment. Many times there is then friction in running that application in production.
With containers developers can now package up all the libraries and runtimes required to successfully develop, test, and execute an application. Thus, you have a portable, lightweight application runtime that allows seamless collaboration between developers and operations. This ensures successful deployment of the application in any environment that supports containers.

How to get started with containerization

Docker is the most popular solution right now for containerization. Docker performs two main tasks— fetching images, in a manner not dissimilar to yum or apt-get, and running a process within that image with suitable Linux kernel flags to limit what that process can see.
While Docker is undoubtedly useful as part of a development workflow, it takes more than that to handle production workloads with multiple containers across multiple machines.
That’s where a container orchestration service is needed (like Spotify’s Helios). The most popular one right now is Kubernetes, an open source platform by Google, which works with Docker containers.
Google offers Kubernetes as a service, called Google Container Engine. It is also possible to use Kubernetes on AWS, VMWare Openstack, and even ‘bare metal’ servers.
The advantage Kubernetes gives is that it provides a layer of abstraction. It’s service oriented. Instead of managing servers—specifying what should be installed and how it should be configured—with Kubernetes one simply declares what services should be running and what services should be exposed.
Give me an example…
Let’s say you’re building a web service. The traditional way would be to use Puppet or Chef to handle multiple servers, which will deal with requests and have a database.
You may have to manually configure these servers to handle networking (load balancing, assigning IP addresses, QoS), and resource management. If one of the servers goes down, or a certain service—like the database—fails, the entire system could go offline.
Instead, if you’re using Kubernetes and containerization and you’re building a web service, you specify to Kubernetes you’ll use three containers for handling server requests, one container as a MongoDB database, and one to run Redis to store session data. Kubernetes will take care of which servers to allocate containers to, and which resources to use, and will handle all networking and communication.

Any limitations?

The foundation for containerization lies in the LinuX Containers (LXC) format, which is a userspace interface for the Linux kernel containment features. Thus, it can only run on Linux environments, and run only Linux applications.
Containers also don’t provide complete isolation and security like Virtual Machines, and it’s not a mature technology yet, so documentation and support may be limited.

Conclusion

Containerization services like Docker, coupled with orchestration services, can greatly simplify testing and deployment of code. They’re not only fast but portable and easy-to-use.

Ayushi Jain
Ayushi has been a software developer at iCiDIGITAL since 2014. She has over 2 years of experience in application development, particularly using Java based development frameworks. She is always eager to adapt and likes to be on the forefront of new and upcoming technologies. Ayushi wears several hats, dabbling between front-end and back-end developer as well as QA roles. In her spare time, she likes to cook, swim, kayak, explore bike trails or just read a book by the lakeside.
View All Posts By This Author

Subscribe to Our Newsletter

Get the latest insights from Blue Acorn iCi

Let's build something together.