When comparing Type 2 Hypervisor vs Container, the Slant community recommends Container for most people. In the question“What are the best approaches to OS virtualization?” Container is ranked 4th while Type 2 Hypervisor is ranked 5th. The most important reason people chose Container is:
The whole stack can be easily packed and moved.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Ease of use
By running on hosts operating system, type-2 hypervisors can be installed and set up the same way any other software is installed.
Pro Lots of flexibilty of what hypervisors on what OSs are run
Hosts hardware can run multiple OSs and multiple type-2 hypervisors can be run side by side on each of the operating systems.
Pro Can run multiple operating systems
Hypervisors can emulate hardware separately for each host allowing them to run multiple operating systems.
Pro High portability
The whole stack can be easily packed and moved.
Pro Fast startup times enable a highly flexible infrastructure
New containers can be quickly spun up based on changing need.
Pro High density
Two to six times more virtual environments can be created via containers as compared to hypervisors for the same hardware cost since containers don't need to emulate hardware and repeating OS elements for each guest OS.
Pro Dynamic resource allocation
Containers can be assigned, for example, more memory during runtime.
Cons
Con Very high overhead
Very low density, performance, scalability. Additional performance hit from OS layer.
Con Security concerns
Since containers are run using shared resources, if any container is compromised, the host is compromised as well.
Many of the security concerns can be alleviated by running containers within hypervisors.
Con Limited to one kernel and OS
All containers on a host will have the same kernel and OS.