How do containers differ from virtual machines with regards to their function and resource utilization?
With regards to function and resource utilization, containers serve as lightweight and isolated environment for executing applications and their dependencies. Containers run swiftly because they utilize the host operating system and operating system’s kernel, which in turn makes them a cost effective option. Virtual machines on the other hand emulate the complete computers as they run a complete operating systems and have their own kernel. VM incur additional costs as more resources are required when compared with containers.
For details, here is a link to a helpful resource: Containers vs. virtual machines | Microsoft Learn
In terms of Function.
VM’s are heavyweight virtualizations that creates complete operating systems (OS) for each virtual machine. This VM O.S have hypervisor which is also a software that sits in the middle of the VM O.S and the Systems Hardware it self.
VM’s can run virtually any type of applications that containers may not be able to.
Containers on the otherhand are lightweight virtualization. In containers, the host machine shares its operating systems kernel. each container workks seperate from one another. Continers are usually for microservices.
In terms of Resource utilization
Conytainers are more efficient in terms of resource utilization than VMs because containers share host machines O.S kernel , unlike the Virtual machines.
VM’s are less efficient compared to containers because they use their own kernels. VM’s however can have good security over containers
While my discussion is not focussing on the technical differences between containers and virtualization, I will talk about our workflow implementations using containers, and that I find this much easier to code and implement over a virtual machine.
I find containers are quite useful for creating specialized operating environments that I can easily schedule and distribute onto our cluster. We have code that is very specific about code, libraries, and utilities, and we can easily distribute these onto our cluster.
I also find containerization quite useful for controlling versions of code. This keeps us independent of whatever the system operators make the defaults. This is really quite useful when changes in, for example, an R library make changes in the functions’ API. This prevents any issues with a sudden change in the version of something suddenly requiring code changes.
With some workloads, we can launch multiple containers onto a node and execute different codes in those different containers.
When we were laying out the proposed workloads and implementation, containers were the easy winner.