What is the difference between virtual machines and application containers?
Application containers are hot today, with analysts saying that it will continue to grow. In fact, 451 Research predicts that the application containers market will reach $1.53 billion this year and it will continue to grow to $2.67 billion by 2020. This is because containers are paving the way for agile and quick development.
Even with the optimism, there are several questions that you should ask about containers, including:
- How is it any different from virtual machines?
- If they are disposable and temporary, how can you use containers together with persistent storage?
- How does a containerization strategy complement your current orchestration and virtualization solutions?
Answering all of these questions will take some time, but we can answer the first one right now. How are containers different from virtual machines?
Servers became more powerful and capable, but bare metal applications are not able to take advantage of these. Virtual machines were created by running software that would use up the extra resources. These virtual machines mimic a hardware system. All of these are monitored by a hypervisor. A hypervisor is a hardware, firmware, or software that you need to create or run virtual machines. It is needed to virtualize the server. It sits between the virtual machine and the hardware.
Each virtual machine has a guest operating system, and two different virtual machines running two different OSes can exist on the same server. For instance, one that runs Linux and another that runs Microsoft can be hosted on one server. Each VM would have its own applications, libraries, and binaries.
There are many benefits of using server virtualization. One of the main ones is that you would be able to use it to bring together all your applications on just one system. You no longer have to host different versions of the same app on separate servers. This makes way for cost savings, faster provisioning, and better disaster recovery strategies. It is easier and faster to develop new applications as well.
On the minus side, each VM would require you to get more storage and memory. Plus, it makes software development a whole lot more complex. Using VMs, you would have very limited portability as you take your applications from public clouds to your traditional data center to private clouds.
You can think of application containers as a scaled down virtual machine. You can use containers to run isolated systems using a single server running its host operating systems. Containers would not need their own binaries, libraries, and operating systems, which means that you get to save on memory and storage. As such, while virtual machines can be gigantic in size, you only need a few megabytes for your container. A container also takes a few seconds to initialize, while virtual machines may take minutes to start.
Compared to virtual machines, management tasks are also fewer when containers are involved. You only need to take care of one operating system, you will only fix bugs and apply patches to one system, and all that. Taken together, this makes containers more portable and lightweight than virtual machines.
Photo courtesy of Brookhaven National Laboratory.