Understanding Containers 101
What are containers made from?, this has been a question I asked myself often when I first came across the word container (not shipping ones…). It happened kind of accidentally last year as I was working as a back end developer at my workplace and our Software Architecture Consultant asked me to look into a tool called Docker as we had to recreate a new CI/CD pipeline for the platform and deploying our independent application components in containers should be the first phase of achieving that. Since then I loved containers, loved Docker and the whole DevOps culture. But as the title for this story says, I had to wait a bit longer and dig bit deeper to get answers for this question right. Hence I thought to break the answer into understandable pieces and share what I learned with all of you.
For the sake of clarity I’m going to break this article into several components. I will publish the three components separately, so that this won’t be too long and boring to read.
1] What are containers?
2] Why does they exists and why are they important?
3] Golden Question — From what are they made?
1] What are containers?
We all heard this thing within the first google search to find what is a container. People often use this as an analogy to give the initial understanding of a container. But the thing is analogies tend to miss the whole point. It will help us understand a concept in a more high level easily by comparing to a thing that’s already familiar to us but with the trade-off of losing lots of information around it.
So as the first rule of containers, remember that,
“Containers are not VM by any means, dark or light doesn't matter. I repeat the Containers are not VM” — VM (Virtual Machine)
If that so what are those?
There are lots of features that make a container. If I’m explaining it to some body I will start off with saying Containers are just a process running on a host machine. To understand the thing bit deeply we should compare Virtual Machines with containers.
When we think of Virtual Machines with the use of hypervisor abstracts the underneath physical hardware which allows you to see multiple VMs running on a single machine. Each VM will have a complete copy of the OS with them which are huge in size and takes time to boot.
But when compared with containers, containers leverage the abstraction in OS. Earlier I told you its just a process running on the host machine, so not booting like VM. Multiple containers can run on the same host machine sharing the OS kernel and when compared in size container sizes are mostly in MBs. This allows containers to perform faster. Since containers app layer that packages code and dependencies together, they allow us to ship code around in a repeatable and a secure way.
Given below is a diagram which compares between the VMs and containers, which will allow you to understand the main key differences between the two components.
I hope that this gave you a basic understanding of what containers really are. From here I would encourage you to dive in and find out how containers are actually made, how they work internally, which will allow you to understand containers more deeply.