Learning Library

← Back to Library

Containerization Advantages Over VMs

Key Points

  • Container technology dates back to Linux’s 2008 introduction of cgroups, which laid the groundwork for Docker, Kubernetes, Cloud Foundry, Rocket, and other runtimes.
  • Unlike virtual machines that require a full guest OS and its libraries for each instance—often inflating a tiny Node.js app to 400 MB—containers bundle only the app and its direct dependencies, keeping the image under 15 MB.
  • Scaling with VMs duplicates the entire guest OS each time, consuming excessive hardware resources, whereas containers share the host kernel and can be replicated with minimal overhead.
  • Deploying directly to VMs can expose “works on my machine” incompatibilities (e.g., macOS development vs. Linux production), a problem containers mitigate by providing a consistent runtime environment across environments.

Full Transcript

# Containerization Advantages Over VMs **Source:** [https://www.youtube.com/watch?v=0qotVMX-J5s](https://www.youtube.com/watch?v=0qotVMX-J5s) **Duration:** 00:08:10 ## Summary - Container technology dates back to Linux’s 2008 introduction of cgroups, which laid the groundwork for Docker, Kubernetes, Cloud Foundry, Rocket, and other runtimes. - Unlike virtual machines that require a full guest OS and its libraries for each instance—often inflating a tiny Node.js app to 400 MB—containers bundle only the app and its direct dependencies, keeping the image under 15 MB. - Scaling with VMs duplicates the entire guest OS each time, consuming excessive hardware resources, whereas containers share the host kernel and can be replicated with minimal overhead. - Deploying directly to VMs can expose “works on my machine” incompatibilities (e.g., macOS development vs. Linux production), a problem containers mitigate by providing a consistent runtime environment across environments. ## Sections - [00:00:00](https://www.youtube.com/watch?v=0qotVMX-J5s&t=0s) **From VMs to Containers: Evolution** - The speaker outlines the history of container technology, explains how cgroups enabled modern containers, and contrasts deploying a Node.js app via traditional virtual machines versus lightweight containers. ## Full Transcript
0:00hi everyone my name is Sai Benin and I'm 0:02a developer advocate with IBM today I 0:04want to talk about containerization 0:06whenever I mentioned containers most 0:08people tend to default to something like 0:09docker or even kubernetes these days but 0:12container technology has actually been 0:14around for quite some time it's actually 0:15back in 2008 that the Linux kernel 0:17introduced C groups or control groups 0:20that basically paved the way for all the 0:22different container technologies we see 0:24today so that includes docker but also 0:26things like cloud foundry as well as 0:28rocket and other container runtimes out 0:30there let's get started with an example 0:32and we'll say that I wasn't developer 0:35and I've created a node.js application 0:39and I want to push it into production 0:42well take two different form factors to 0:44kind of explain the advantages of 0:46containerization so let's say that first 0:48we'll talk about VMs and then we'll talk 0:51about containers so first things first 0:58let's introduce some of the things that 0:59we've got here so we've got the hardware 1:01itself just big box we've got the guest 1:05or rather the host operating system as 1:10well as the hypervisor hypervisor is 1:12actually what allows us to spin up VMs 1:15already we've let's take a look at this 1:18shared pool of resources with the host 1:19OS and hypervisor we can assume that 1:22some of these resources have already 1:24been consumed next let's go ahead and 1:27take this JSON and push it in and to do 1:30that I need a Linux VM so let's go ahead 1:34and sketch out that Linux VM and in this 1:39VM there's a few things to note here so 1:41we've got another operating system in 1:43addition to the host OS is going to be 1:45the guest OS as well as some binaries 1:48and libraries so that's one of the 1:50things about Linux VMs that even though 1:52we're working with a really lightweight 1:53application to create that Linux VM we 1:57have to put that guest OS in there in a 1:58set of binaries and libraries and so 2:01that really bloats it out in fact you 2:02know I think the smallest node GS VM 2:05that I've seen out there is 400 plus 2:07megabytes whereas the the the node.js 2:09runtime and app itself would be you know 2:11under 15 so 2:13we've got that with and we go ahead and 2:16let's push that Jay s application into 2:18it and just by doing that alone we're 2:20going to consume a set of resources next 2:25let's think about scaling this out right 2:27so we'll create two additional copies of 2:31it and you'll notice that even though 2:34it's the exact same application we have 2:36to use and deploy that's that's separate 2:39guest OS and libraries every time and so 2:42we'll do that three times and by doing 2:45that essentially we can assume that for 2:48this particular hardware we've consumed 2:51all of the all of the resources and 2:53there's another thing that I haven't 2:55mentioned here but this jeaious 2:57application I developed it on my macbook 2:59so when I pushed it into production to 3:02get it going on the VM and noticed that 3:03there were some issues and 3:04incompatibilities this is the the kind 3:07of foundation of this big he-said 3:09she-said issue where things might be 3:11working on your local machine and work 3:13great but when you try to push it into 3:14production things start to break and 3:16this really gets in the way of doing 3:18agile devops and continuous integration 3:20and delivery that's solved when you use 3:23something like containers there's a 3:25three-step process when kind of doing 3:27anything container related and pushing 3:29or creating containers and it almost 3:32always starts with first some sort of a 3:34manifest so something that describes the 3:37container itself so in the darker world 3:41this would be something like a docker 3:42file and Cloud Foundry this would be a 3:44manifest yamo next what you'll do is 3:46create the actual image itself so for 3:49the image you know in again if you're 3:52working with something like docker that 3:54could be something know be a docker 3:56image for working with rocket it would 3:58be an ACI or application container image 4:00you know so regardless of the different 4:03containerization technologies this 4:04process stays the same 4:05and the last thing you end up with it's 4:08an actual container itself you know that 4:10contains all of the runtimes and 4:12libraries and binaries needed to run an 4:14application that application runs on a 4:18very similar set up to the VMS but what 4:20we've got on this side is you know again 4:22a host operating system the difference 4:25here instead of a hypervisor we're going 4:27to have 4:27things like a runtime engine so if 4:31you're using docker this would be the 4:34docker engine and you know different 4:37different containerization technologies 4:39would have a different engine 4:40regardless it's something that runs 4:41those containers again we've got this 4:43shared pool of resources so we can 4:45assume that that alone consumes some set 4:49of resources next let's think about 4:52actually container izing this technology 4:54so we talked about the three-step 4:55process we create some you know a docker 4:58file we build out the image we push it 4:59to a registry and we have our container 5:01and we can start pushing this out as 5:03containers the great thing is these are 5:05going to be much more lightweight so 5:08deploying out multiple containers since 5:13you don't have to worry about a guest OS 5:16this time really just have the libraries 5:19as well as the the application itself so 5:22we've scaled that out three times and 5:24because we don't have to duplicate all 5:26of those operating system dependencies 5:29and create bloated VMs we actually will 5:32use less resources so she's a different 5:35color here and scaling that out three 5:39times we still have a good amount of 5:43resources left next let's say that my 5:46coworker decides hey for this j/s 5:48application let's take advantage of a 5:50third party you know let's say a 5:52cognitive API to do something like image 5:54recognition so you know let's say that 5:56we've got our third party service and we 6:01want to access that using maybe a Python 6:03application so he's created that service 6:07that accesses that third party API and 6:11with our node.js application we want to 6:14access that Python app to then access 6:16that that service if we wanted to do 6:19this in VMs I'm really tempted to 6:22basically create a VM out of both the 6:24JSO plication and the Python application 6:27because essentially that would allow me 6:29to continue to use the VMs that I have 6:31but that's not truly cloud native right 6:33because if I wanted to scale out the the 6:35j/s but not the Python app I wouldn't be 6:38able to if they were running in the same 6:39VM so to do it 6:41Trulli cloud native way essentially I 6:43would have to free up some of these 6:44resources basically get rid of one of 6:46these VMs and then deployed the Python 6:49application in it instead and you know 6:52that's not ideal but with the container 6:55based approach what we can do is simply 6:57say since we're modulars we can say okay 7:00just deploy one copy of the Python 7:05application so we'll go ahead and do 7:07that there's a different color here and 7:11that consumes a little bit more 7:13resources and then you know with those 7:15those remaining resources the great 7:17thing about container technology that 7:19actually becomes shared between all the 7:21processes running in fact another 7:23advantage if something if these 7:25container processes aren't actually 7:26utilizing the CPU or memory all of those 7:30shared resources become accessible for 7:33the other containers running within that 7:35within that hardware 7:37so with container based technology we 7:40can truly take advantage of cloud native 7:42based architectures so we talked about 7:44things like portability of the 7:45containers we talked about how it's 7:47easier to scale them out and then 7:49overall with this kind of three-step 7:50process and the way we push containers 7:52allows for more agile devops and 7:55continuous integration and delivery 7:56thanks for tuning in for this broad 7:58overview of container based technology 8:00as always we're looking for feedback so 8:02definitely drop a comment below and be 8:04sure to subscribe to stay tuned for more 8:06videos in the future thank you