Exploring Containers – Part 1
I like to think I am a fairly smart guy. More than that, I know I work with a bunch of really smart people. Given this, I found it interesting to find that pretty much no one on my team has any idea what “containers” are, what they do, or how they work. All we know for sure is that Mark Russinovich thinks they are a nifty new feature of Server 2016 and Windows Azure.
I decided it was time to figure this stuff out, so I dove into a search on Channel9. Here’s a Q&A I had with myself after I watched a few of those videos.
So what are Containers?
Containers are a OS/Application virtualization and image layering technology. Containers host applications and application dependencies. Containers are built from container images, and they are portable.
So containers are a new kind of Virtual Machine, right?
The short answer is yes; containers are a new kind of virtual machine. There is, however, a lot more to it than that.
VMs were created to solve the problem of hardware underutilization. In the late 90s we had datacenters filled with servers that were barely doing anything. We could not consolidate application onto fewer servers because those applications (and Operating Systems) were crap. If we tried to run two different applications on the same server, everything would explode. Introduce VMs into your datacenter and you can run multiple applications on a single server without things exploding!
The problem that Containers are here to solve is the amount of time it takes to manage and deploy VMs. I guess you can think of Contains as a way to break down VMs into smaller part that can be managed separately. You can take those smaller parts and put them together very quickly into functional applications.
How are containers different from Hyper-V Virtual machines?
The basic differences have to do with how much “stuff” is in a Container vs how much is in a VM. Here is a drawing that shows the difference.
Um… OK…. So what does that drawing mean?
Without going down into too much crazy detail at this point, count the number of times “OS/Kernel” appears on the left (Virtual Machines) vs how many times it appears on the right (Containers).
When you create a VM, you are basically taking your physical hardware and “carving out” a piece of it to use to run a completely new instance of Windows Server. Every VM is completely isolated from every other VM and the host by the Hypervisor.
With Containers, there is no Hypervisor and there is only a single version of the OS/Kernel. This gives us less security between the Containers, but it also allows us to create new Containers much faster.
I guess I kind of get that. What are “Container Images” then?
Container Images are read only templates used to create a container. They contain application, dependences for applications, and instructions for starting up that container. Container Images are stored in and retrieved from a Container Image Registry.
Container Images are comprised of multiple layers, and these layer are shared between containers images. I might have a single layer that contains a web application, and then a second layer that specific settings and configurations for that application.
Awesome, so now I understand Containers!
Not even close. This blog post is just the super high level version. Stay tuned and I’ll get you all learned up as I figure out what I am talking about.
Continue this series with Part 2