Home  >  Article  >  Operation and Maintenance  >  What is the difference between kvm and docker

What is the difference between kvm and docker

青灯夜游
青灯夜游Original
2021-11-25 16:27:549074browse

Differences: 1. In terms of startup speed, Docker is on the second level, while kvm is on the minute level; 2. Compared with kvm, the performance of Docker applications is high and the system overhead is small; 3. In terms of saving status , Docker is more portable and low-cost than kvm; 4. In terms of hard disk usage, Docker is measured in MB and kvm is measured in GB.

What is the difference between kvm and docker

The operating environment of this tutorial: linux5.9.8 system, docker-1.13.1 version, Dell G3 computer.

Introduction to Docker

The goal of the Docker project is to implement a lightweight operating system virtualization solution. Docker is based on technologies such as Linux Containers (LXC).

Based on LXC, Docker has further encapsulated it so that users do not need to care about container management, making the operation easier. Users operating Docker containers are as easy as operating a fast and lightweight virtual machine.

The picture below compares the differences between Docker and traditional virtualization methods. It can be seen that containers implement virtualization at the operating system level and directly reuse the operating system of the local host, while the traditional method implements virtualization at the hardware level. level implementation.

Comparison between Docker and KVM (traditional virtual machine)

As an emerging virtualization method, Docker has many advantages compared with traditional virtualization methods.

1. Docker containers can be started in seconds, which is much faster than the traditional virtual machine method. Secondly, Docker has a high utilization rate of system resources. Thousands of Docker containers can be run simultaneously on one host.

2. In addition to running the application in it, the container basically consumes no additional system resources, making the application performance very high and the system overhead as small as possible. The traditional virtual machine method requires 10 virtual machines to run 10 different applications, while Docker only needs to start 10 isolated applications.

3. Virtualization technology relies on physical CPU and memory and is at the hardware level; while docker is built on the operating system and utilizes the containerization technology of the operating system, so docker can even run on a virtual machine.

4. Virtualization systems generally refer to operating system images, which are relatively complex and are called "systems"; while docker is open source and lightweight and is called "containers". A single container is suitable for deploying a small number of applications, such as A redis, a memcached.

5. Traditional virtualization technology uses snapshots to save the state; docker is not only more portable and low-cost in saving the state, but also introduces a similar source code management mechanism to store the snapshot historical versions of the container one by one. Records, switching costs are low.

6. Traditional virtualization technology is more complex when building the system and requires a lot of manpower; while docker can build the entire container through Dockfile, and restart and build quickly. More importantly, the Dockfile can be written manually, so that application developers can guide the system environment and dependencies by publishing the Dockfile, which is very beneficial to continuous delivery.

7. Of course, KVM also has a big advantage compared to containers, which is that it can use different operating systems or kernels. So, for example, you could use Microsoft Azure and run an instance of Windows Server 2012 and an instance of SUSE Linux Enterprise Server simultaneously. As for Docker, all containers must use the same operating system and kernel.

Comparison summary

Features

Docker container

KVM virtual machine

##Start

seconds Level

Minute level

Hard disk usage

Generally MB

Generally GB

Performance

Close to native

Weaker than

System support capacity

Single machine supports thousands of containers

Generally dozens

# Recommended learning: "docker video tutorial"

The above is the detailed content of What is the difference between kvm and docker. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn