This is Part 3 of cloud computing tutorial. In this video, we'll discuss,
what are containers and how are they different from virtual machines. In our previous video,
we discussed what are virtual machines and how they allow us to run multiple applications on a
single physical server. However, with each virtual machine that we create, there is a lot of overhead
both in terms of cost and maintainability. Let's understand this with an example.
Let's say we have four applications App 1 to App 4. We want to be able to run all these four apps
on one physical server - Server 1. Obviously, we cannot run applications directly on the server
hardware. We need an operating system like Windows or Linux. This is the host operating system
that is the operating system at the server level. On top of this we install, a piece of software
called - Hypervisor. It is this Hypervisor that creates and manages virtual machines.
We have four apps that we want to run in isolation on this single physical server. So, we create four
virtual machines. As we discussed in our previous video, a virtual machine
virtualizes the hardware of the physical serve. This means, each virtual machine that is created
gets a slice of the server hardware. In our case, we created four virtual machines. So,
each VM gets 25% of memory, disk space, processor and other server hardware resources.
Now, our business applications that is App1 to App 4 cannot directly run on a virtual machine.
Keep in mind, a virtual machine virtualizes the server hardware. This means, in simple terms a
virtual machine is a slice of the underlying server hardware and an application cannot
run directly on the hardware. So, for a virtual machine to be able to run a software application,
it needs a full copy of its own operating system. In our case, we have four virtual machines. So,
this means, we need to install four operating systems, one on each virtual machine, usually
Windows or Linux. This operating system that is installed on a virtual machine is usually called
guest operating system. So, on top of this guest operating system on the VM, we install our
business application and any dependencies it might need. Now, just imagine, the server resources that
are required to install and run four operating systems. So much of server resources like disk
space, memory and processor time are wasted just to keep these VMs up and running. In
addition to the wasted server resources, each installation of the operating system also needs
admin time. For example, if there is an update or a security patch available for the operating
system, the admin needs to download and install it on all the affected VMs. In addition to this,
we also have to pay for four operating system licenses. Remember, a virtual machine is like
a computer within a computer. It has its own operating system. So, for a virtual machine to be
up and running, its operating system must also be booted up. Booting up an entire operating system
obviously consumes a lot of time. In our example, if we want App1 to be up and running VM 1
operating system must be booted up in addition to booting up the host operating system that is
the operating system at the physical server level. Now, let's understand what containers are and how
they are set out to solve these issues. We have a side-by-side comparison here. Remember, a virtual
machine virtualizes the server hardware whereas containers virtualizes the operating system that
is it's an abstraction at the operating system level. Multiple containers can run on the same
machine and more importantly they can share the host operating system kernel. Unlike a virtual
machine, a container does not require its own operating system. So, straight away you can say
the amount of disk space, RAM, processor time and other server resources that are saved. Each
container, packages your application code and its dependencies together. If you have three apps to
run on a single physical server, you create three containers. Each application thinks, it is running
on a dedicated operating system and a dedicated server hardware, but, in reality all the container
applications are sharing the same host operating system and hardware. In case of virtual machines,
admin time is required to install security patches and keep up to date host operating system and the
guest operating systems on all the vms. In case of containers, no matter how many containers we have
on our server, there is just one host operating system that demands admin time. From the cost
standpoint, in case of vms we have to pay for host and the guest operating systems of all the
vms whereas in case of containers we have to pay just for one host operating system. A container is
very small compared to a virtual machine. Since a container does not have its own operating system
to boot up, it can usually be brought online in a very less time compared to booting up
an entire virtual machine and its operating system. Will see virtual machines and containers
in action in our upcoming videos. That's it in this video. Thank you for listening.