To Contain or to Virtualize?
Simple answer…it depends! Container virtualization is being embraced by tech companies worldwide, while virtual machines (VMs) continue to be the popular choice in data centers of all sizes.
What are VMs?
Virtual machines (VMs) allow us to multiple physical servers running your website and other services and consolidate them to run on one server. Each virtual machine contains its own operating system and consumes a portion of the hardware resources of the host server the VM is running on. Virtual machines can be resource intensive as each virtual machine contains a full copy of the operating system and a virtual copy of the hardware the operating system needs to run. Virtual machines may be bloated to some applications that do not require complete access to the operating system or entire access to the underlying virtualized hardware. This is where containers come into play.
What are Containers?
Containers can be thought of as using a rideshare service. You need to get from point A to point B, but you are not concerned with how. By leveraging a rideshare service, you can feel confident that you’ll have a vehicle that’s reliable and can get you to where you need to go. It doesn’t matter what type of vehicle, the size of its engine, the type of tires, or its color. This is essentially how containers function.
The major difference between a container and a virtual machine is that a container sits just above the operating system where a virtual machine sits just above the hardware. The virtual machine will have a virtualized copy of the hardware and the full operating system whereas a container only has a virtualized copy of the operating system. since the container does not have a virtualized copy of the hardware the overall footprint of a container is a lot smaller than a virtual machine. Thus, a container can start up in seconds where some virtual machines can take minutes to run.
Benefits of Containers
Containers provide a consistent & controlled environment that ensure stability of the underlying platforms & technologies. Containers provide assurance that the software code will work on multiple environments seamlessly. When multiple developers use containers, the practice eliminates the “it worked on my machine” problems that they often face. It allows a focus on rapidly developing functionality because the focus is on the code, not the underlying software/OS configuration. Also, it greatly improves the Quality Assurance practices because of the consistency between environments and isolation of code, which as a result allows problems with the code to be quickly identified.
VMs have an entire copy of the operating system and a copy of all the virtualized hardware for the system to run. As you can guess, VMs are normally GBs in size and sharing an application running on the VM can be complicated as it has dependencies on the operating system. Containers only require minimal resources such as runtime components, libraries, and bins. This minimalistic approach allows for containers to be as small as 10MB in size. The small size of containers and its snapshot approach to the kernel make for quick startups of applications and easy distribution. Therefore, containers are excellent for Continuous Deployment and Continuous Integration (CI/CD) implementations. Containers encourage collaborative development by distributing and merging images among developers.
What about security?
Containers share the kernel of the host operating system thus isolation is not possible as it is with a virtual machine. If the host operating system of the container provider has been compromised, then that also exposes all the applications that have been containerized. The virtual machine is truly siloed from other virtual machines as only the hardware that has been virtualized is common to each instance. The VMs ability to be truly isolated provides an ideal environment for application experimentation and development.
So, the choice between going with a virtual machine or a container really depends on your specific use case. If your project or application requires access to the underlying hardware, such as USB devices that are connected to the computer, or there is a need for a true sandbox environment, then a virtual machine would better fit your use case. For most other applications, containerization would work extremely well for you.
At Artic, we make use of virtual machines to host our primary website, as well as our clients’ websites on a custom-developed Azure platform that provides high availability and best-of-class performance. We have experience using container-based build platforms for all of our projects, as well as application development using Docker and Kubernetes. Contact us to see how we can help your business make use of the benefits of these technologies.