1. Security
Enhanced Security of Virtual Machines
Strong Security Boundary
Virtual Machines (VM) are more secure than containers as the applications run inside the VM, i.e. Guest OS, and communication happens to the hardware via the Hypervisor. VMs have a strong security boundary in place which is not the case with containers as they do not have a robust security boundary. Also, a lot of work has been done in terms of Security and Data Encryption in the Virtual Machines than when compared to Containers.

Compartmentalized Security
Any compromise with the VM would not affect or let the attacker gain access to another VM as the security aspect is in the control of hypervisor. This compartmentalized security is unmatched by containers and gives VMs a clear edge in terms of security.
2. Running Older Applications
VM’s for Running Older Applications
When it comes to running Older Applications or the Apps that run on top of older versions of the Operating Systems, VMs are the go-to choice. Since it might not be possible to modernize the application to run inside of a container, running the old OS as a VM and running the application on top of it is the most suitable option.
3. Applications that are OS resources intensive
VM’s for Resource Intensive Applications
VMs are preferred when we have to host or run applications which are resource intensive and require the OS functionality and resources. When it comes to running a variety of OS, VMs are the superior choice compared to containers. Containers use the Host’s kernel and cannot be isolated like the VM’s as they run their own Kernel.
4. Use of Host OS and compatible kernel (Portability)
Portability of VMs
We can run multiple VM’s running different guest OS (having their own kernel) on top of the host/server. Whereas with the containers, since they use the kernel from the Host OS they are limited to the operating system and hence a container designed to run on a particular host OS would not be able to migrate to another server running a different kernel and would have compatibility issues while migrating containers.
5. Graphical User Interface (Video Output)
<h2>VMs for Graphical User Interface (Video Output)</h2>
Containers are ineffective when it comes to video output/support as they are mainly meant for console applications. Running tools or software that have a graphical interface or need a rich GUI is easier on the VM’s with the use of virtual display on the host machine. VMs are the preferred solution when we need to run GUI based apps.
6. Persistent Storage
Persistent Storage with VMs
The VM’s have virtual disk that are used to store the application data persistently. This is not the case in Containers, the containers use what we call ephemeral storage (Containers are stateless by default). With the growing demand and need for stateful applications, containers are posed with the challenge to add a storage solution. When it comes to persistent storage, VM’s are the better choice compared to the containers as we would need to implement complex storage solutions in the latter.
The below image illustrates the differences between Virtual Machines and Containers.