📜  虚拟机和容器的区别

📅  最后修改于: 2021-09-11 03:41:36             🧑  作者: Mango

虚拟机和容器是在单个平台上部署多个隔离服务的两种方式。

虚拟机:
它运行在称为虚拟机管理程序的模拟软件之上,该软件位于硬件和虚拟机之间。管理程序是启用虚拟化的关键。它管理物理资源到虚拟机的共享。每个虚拟机都运行自己的客户操作系统。与容器相比,它们的敏捷性和可移植性较差。

容器:
它位于物理服务器及其主机操作系统的顶部。他们共享一个通用的操作系统,需要关心和提供错误修复和补丁。与虚拟机相比,它们更灵活,具有更高的可移植性。

让我们看看虚拟机和容器之间的区别。

SNo. Virtual Machines(VM) Containers
1 VM is piece of software that allows you to install other software inside of it so you basically control it virtually as opposed to installing the software directly on the computer. While a container is a software that allows different functionalities of an application independently.
2. Applications running on VM system can run different OS. While applications running in a container environment share a single OS.
3. VM virtualizes the computer system. While containers virtualize the operating system only.
4. VM size is very large. While the size of container is very light; i.e. a few megabytes.
5. VM takes minutes to run, due to large size. While containers take a few seconds to run.
6. VM uses a lot of system memory. While containers require very less memory.
7. VM is more secure. While containers are less secure.
8. VM’s are useful when we require all of OS resources to run various applications. While containers are useful when we are required to maximise the running applications using minimal servers.
9. Examples of VM are: KVM, Xen, VMware. While examples of containers are:RancherOS, PhotonOS, Containers by Docker.