Containerized applications and their dependencies run in an isolated environment called a container. Containers and Virtual Machines (VMs) are very much similar in a way that both are virtualization technologies used to maximize computer hardware and software resources. However, they are not the same. Calling a container a “lightweight VM” is wrong. The image below shows the difference between container vs. VM. You can see that each VM requires different Operating Systems (OS), and containers share a single host OS kernel:
Virtual Machine (VM)
A VM requires a guest OS, which includes some services and components that are not essential for running the application. The developer can remove these to make the VM lightweight. A VM is technically a virtual physical server. It has virtual hardware, which includes CPU, memory, storage, etc., that runs on a hypervisor.
Containers do not require a guest OS or multiple operating systems since the host operating system (OS) shares its underlying hardware resources with the containers. It also includes the application and its dependencies. Containers virtualize the process level or the software above the operating system level, making them lightweight or relatively smaller in size.
Containers are created from container images by a container engine with the application code and its dependencies. A container is basically a container image run by a container engine.
Numerous container engines are available for creating, managing, and running containers. The Docker engine is the most widely used container engine. Here’s a rundown of other examples of container engines:
- Open Container Initiative
- Windows Containers
Advantages of Using a Container
Using container technology provides the following benefits and advantages over VMs:
- Portable – the container image includes everything an application needs to run.
- Lightweight – the container image only includes the application and its dependencies.
- Fast – the OS is already running. It doesn’t need to boot with a virtual BIOS and OS.
- Scalable – it is easy to add more identical containers.
- Isolation – if a container fails, other containers on the same OS are unaffected.
Disadvantages of Using a Container
In container vs. VM, there are also disadvantages to using a container. Some of these are:
- Security – since containers run on the same OS, they are less secure than virtual machines, which are fully isolated.
- Updates – updating a container would require rebuilding a new container image.
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: