Featured image of post Containers & Docker

Containers & Docker

What's all of the fuzz about?

I declare myself a fanatic of containers, so to start off this series of publications, I want to talk about a topic that I really like. While I’m constantly learning, I’d like to discuss what (little) I know so far about this field and all the passions that this explosion of technology has sparked. If this serves as a boost for someone else to delve into this technological adventure, I will feel honored.

First of all, what the heck are containers?

TL;DR;

According to Wikipedia.

It is a type of operating system-level virtualization for Linux. It allows a physical server to run multiple isolated operating system instances, known as Virtual Private Servers (VPS) or Virtual Environments (VE).

A little bit of history, really little…

A few years ago, around 2008, several companies came together and started a project that would lead to one of the most impactful technologies in the world of IT: Linux containers. However, it’s worth mentioning that this technology has been present among us for several years thanks to FreeBSD and Solaris, which introduced Jails and Containers respectively. Linux later joined the technological train.

What superpowers do containers have?

In essence, containers allow us to virtualize things in a very different way than what we are used to or, for those who still don’t want to be cool – hahaha. So how does conventional virtualization work? In short, it simulates hardware for the virtual machine and installs a complete operating system on top of the existing one. This includes the kernel, libraries, binaries, and additional runtimes. What’s the downside of this? Our virtual machines end up running unwanted processes, resulting in inefficient resource usage. Can we control all this mismanagement of resources? Certainly, but in many cases, it means spending a lot of time configuring the machines to our liking or needs, which can be tedious, right?

What if all this could be improved? Well, it is possible to have only the bare essentials on our machines so that what we want to execute in them is not affected by unwanted processes. This is where containers come in. Being a system-level virtualization, which we will now call containerization, it requires kernel modules that enable this magic. These modules use the existing kernel in the system, eliminating the need for a new installation. To get a little nerdy, containers only install necessary binaries, libraries, and runtimes. In addition to this, they require a userland that allows the simulation of different Linux distributions. So, if we are working on Manjaro, like in my case, we can use containers that bring Debian, Fedora, CentOS, among others, all while sharing the kernel installed on our Linux host.

All good, but what’s Docker’s role in all this?

While containers are a super cool technology and, as you already know, they have been with us for some time, it wasn’t as easy to work with them before Docker came along. The existing alternatives were either proprietary or damn complex to use, which limited their use to specialized companies. Well, the creators of Docker had the idea of bringing this container technology to the everyday user and popularizing its use. That’s how DotCloud broke that barrier by developing and releasing Docker in 2013.

We already know what Docker represents, but what is it really?

To summarize, Docker leverages the technology of Linux containers, it is developed around them, and provides tools for their manipulation. These tools include creation, deployment, clustering, networking, deletion, among many others, which I hope to cover in upcoming publications.

Docker vs VMs: How they work

In the following image, you can see the difference in how containerization works compared to virtualization.

In the case of VMs, as I explained before, you can see that we have the host operating system (OS), on top of which the virtualization tool is mounted, and then an instance of a guest OS is run.

Unlike Docker, which runs directly on the host OS, Docker manages the containers to use the kernel and necessary resources of the host OS and its hardware.

Docker vs. VMs

This was just a tiny introduction to this fascinating world. I hope you liked it. Thank you for your time. Any suggestions are welcome.