iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 25
0
Modern Web

用30days 了解web系列 第 25

(Day 25) Docker vs Virtual Machine

  • 分享至 

  • xImage
  •  

when it comes to cloud infra, the virtual machine has been the go-to standart for many of its advantage. However Docker come with a new idea of virtual machine that was more lightweight, economical, and scalable.

docker is a container based lets you develop distributed applications. so for today article we will go through the difference between virtual machine and docker containers.

What is a Virtual Machine?
A virtual machine is a system which acts exactly like a computer.

In simple terms, it makes it possible to run what appears to be on many separate computers on hardware, that is one computer. Each virtual machine requires its underlying operating system, and then the hardware is virtualized.

What is Docker?
Docker is a tool that uses containers to make creation, deployment, and running of application a lot easier. It binds application and its dependencies inside a container.

Docker vs. VM
Infrastructure

https://ithelp.ithome.com.tw/upload/images/20201008/20129609yCbxxeUh3r.png
The operating system support of Virtual machine and Docker container is very different. From the image above, you can see each virtual machine has its guest operating system above the host operating system, which makes virtual machines heavy. While on the other hand, Docker containers share the host operating system, and that is why they are lightweight.

Sharing the host operating system between the containers make them very light and helps them to boot up in just a few seconds. Hence, the overhead to manage the container system is very low compared to that of virtual machines.

The docker containers are suited for situations where you want to run multiple applications over a single operating system kernel. But if you have applications or servers that need to run on different operating system flavors, then virtual machines are required.

Security

The virtual machine does no share operating system, and there is strong isolation in the host kernel. Hence, they are more secure as compared to Containers. A container have a lot of security risks, and vulnerabilities as the containers have shared host kernel.

Also, since docker resources are shared and not namespaced, an attacker can exploit all the containers in a cluster if he/she gets access to even one container. In a virtual machine, you don’t get direct access to the resources, and hypervisor is there to restrict the usage of resources in a VM.

Portability

Docker containers are easily portable because they do not have separate operating systems. A container can be ported to a different OS, and it can start immediately. On the other hand, virtual machines have separate OS, so porting a virtual machine is difficult as compared to containers, and it also takes a lot of time to port a virtual machine because of its size.

For development purposes where the applications must be developed and tested in different platforms, Docker containers are the ideal choice.


上一篇
(Day 24) python vs php for web development
下一篇
(Day 26) create your first Docker application
系列文
用30days 了解web30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言