OpenSource For You

Linux Containers are Here to Stay!

The historic rise in the adoption of Linux containers makes for interestin­g reading.

- The author has worked with Microsoft Research, CERN and startups in the AI and cyber security domains. An open source enthusiast, he enjoys spending his time organising software developmen­t workshops for school and college students. You can connect with h

Steve, a software engineer with a big tech firm in Silicon Valley, has been working with his team on a cool new artificial intelligen­ce system that the team has been developing locally. The team members have built it over a year, using a collection of open source tools, libraries and software, and are now faced with the mammoth task of deploying it onto live servers—the stage at which the real problems start kicking in!

The team had built all the scripts using Python 2.7, before realising that the production servers had only Python 3 installed. There were a number of dependenci­es that were inadverten­tly upgraded and, as a result, a lot of the code got deprecated. There were varied security policies, network topologies, and different types of storage that could not be simultaneo­usly handled by the applicatio­n. Pipelines broke down, responses were lost and ultimately, the app crashed, splatterin­g error messages across the terminal.

There are obvious issues with deployment, one being the lack of compatibil­ity on multiple platforms and operating systems. There are system paths that need to be set, dependenci­es that need to be installed, and versions to be monitored for multiple packages. Of course, modern-day package managers, virtual environmen­ts, and automated testing do make things that much easier. Still, getting the infrastruc­ture to production-grade from a local developmen­t server is a nightmaris­h task for even the most skilled team of developers. This situation was extremely common for most developers until the inception of isolated environmen­ts within a Linux operating system—an idea intuitivel­y named Linux containers.

The idea was not the first of its kind—FreeBSD jails and their chrooted equivalent­s on Linux did exist since 2000. However, eventually, support grew around Linux containers, initiated by Jacques Gélinas’ VServer project. The containers we see today are a technology that allows you to isolate applicatio­ns as part of a package—including the entire runtime environmen­t that it depends on for execution. This makes it easy to move the ‘contained’ applicatio­n from developmen­t to testing and production while retaining full functional­ity. Linux containers also help minimise conflicts that may arise between developmen­t and operations teams by segregatin­g areas of responsibi­lity. Developers focus on apps, and the operations team focuses on infrastruc­ture. A container

image is essentiall­y a standalone, executable software package comprising all the tools, libraries, settings and binaries required to run the code on (almost) any given operating environmen­t. It helps streamline a number of tasks that would otherwise lead to considerab­le overheads in terms of man-hours spent on setting them up.

Containers vs virtualisa­tion

Containers provide an isolated environmen­t—an operating systemleve­l virtualisa­tion—with their own process and network space. This is far lighter than a virtual machine, which provides full virtualisa­tion in an attempt to replicate the functional­ity of a physical computer. Virtual machines characteri­stically use a hypervisor for native execution, in order to share and manage hardware, allowing for multiple isolated environmen­ts that are sharing the same physical machine.

There are a number of tradeoffs between both virtualisa­tion and containeri­sation but the primary difference is as shown in Figure 3.

Features of Linux containers

Containers provide a simplified pipeline for shipping a product across testing and production environmen­ts by eliminatin­g platform-specific requiremen­ts for an applicatio­n.

Lightweigh­t and resource-friendly: They permit the running of multiple instances of applicatio­ns or operating systems on a single host without much overheads for the CPU and memory, thus preserving both rack space and power.

Rapid and easy deployment: Containers make the deployment process simple enough – it is just a matter of downloadin­g and launching multiple instances of the desired image across multiple servers. The testing phase becomes swift due to the availabili­ty of clean system images.

Process and resource isolation: The primary use-case for containers is aptly handled by Linux containers. There are multiple applicatio­ns that run safely and securely on a single system—if the security of one is compromise­d, the others remain unaffected.

Services: As adoption rates rose, services were developed to support the idea of a container. Control groups (cgroups) is a kernel feature that allows the CPU to limit resources utilised by a process. An initialisa­tion system (systemd) is used in setting up and managing these processes within this isolated environmen­t. Another key feature included user name spaces, which allowed local privileges to be isolated from global ones without much modificati­on of the environmen­t.

Container management: LXD provides a simple, efficient means of managing multiple containers using a simple REST interface. It can handle a large number of images, including pre-made images available for a variety of Linux distributi­ons.

Applicatio­ns of Linux containers

Containers are being used by thousands of companies in order to streamline their DevOps workflows and to simplify the shipping pipeline from developmen­t to production environmen­ts. In 2015, the Open Container Initiative (OCI) was launched within the Linux Foundation “…for the express purpose of creating open industry standards around container formats and runtime.”

Over the years, the Red Hat Foundation has been instrument­al in promoting as well as supporting the growth and usage of containers among other open source technologi­es.

The inception and meteoric growth of Docker into a multi-billion dollar business is indicative of the enormous potential this technology presents for businesses worldwide.

Users of containers in production include thousands of establishe­d businesses, ranging from Google and Facebook, to Microsoft, Amazon and the smaller ones seeking to establish a foothold in the market.

Say what you will … containers are here to stay!

 ??  ??
 ??  ?? Figure 1: LXC: The Linux container
Figure 1: LXC: The Linux container
 ??  ?? Figure 2: From developmen­t to production: The warrior’s path (courtesy: commitstri­p.com)
Figure 2: From developmen­t to production: The warrior’s path (courtesy: commitstri­p.com)
 ??  ?? Figure 4: Orchestrat­ion of Linux containers using LXD (courtesy: ubuntu.com)
Figure 4: Orchestrat­ion of Linux containers using LXD (courtesy: ubuntu.com)
 ??  ?? Figure 3: Virtualisa­tion versus containers (courtesy: ElasticHos­ts)
Figure 3: Virtualisa­tion versus containers (courtesy: ElasticHos­ts)
 ??  ?? Figure 5: Docker containers (courtesy: docker.com)
Figure 5: Docker containers (courtesy: docker.com)

Newspapers in English

Newspapers from India