In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly talks about "what's the difference between virtual machine and Docker". Interested friends might as well take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what's the difference between virtual machine and Docker"?
A variety of virtual machine technologies have ushered in the era of cloud computing, while Docker, as the next generation of virtualization technology, is changing the way we develop, test and deploy applications. So what's the difference between a virtual machine and Docker?
In order to ensure readability, this paper adopts free translation rather than literal translation. In addition, the copyright of this article belongs to the original author, and the translation is for learning only.
First of all, you need to be clear that the Docker container is not a virtual machine.
When I came into contact with Docker in 2014, I compared it to a lightweight virtual machine. There is nothing wrong with this, because the secret of Docker's initial success is that it saves more memory and starts faster than virtual machines. Docker keeps telling everyone, "the virtual machine takes a few minutes to start, while the Docker container only takes 50 milliseconds."
However, Docker containers are not virtual machines, so we might as well compare them.
Understanding virtual machines
When running multiple isolated applications using a virtual machine, as shown in the following figure:
Understand the image above from bottom to top:
Infrastructure (Infrastructure). It can be your PC, a server in your data center, or a cloud host.
The main operating system (Host Operating System). On your PC, you may be running MacOS, Windows, or some Linux distribution.
Virtual machine management system (Hypervisor). With Hypervisor, you can run multiple different slave operating systems on top of the master operating system. Type 1 Hypervisor has HyperKit that supports MacOS, Hyper-V that supports Windows, and KVM that supports Linux. Hypervisor of type 2 has VirtualBox and VMWare.
From the operating system (Guest Operating System). Suppose you need to run three isolated applications, then you need to use Hypervisor to start three slave operating systems, that is, three virtual machines. These virtual machines are very large and may have 700MB, which means they will take up 2.1GB disk space. To make matters worse, they also consume a lot of CPU and memory.
All kinds of dependencies. Each slave operating system needs to install a lot of dependencies. If your application needs to connect to PostgreSQL, you need to install libpq-dev; if you use Ruby, you should install gems;. If you use other programming languages, such as Python or Node.js, you will need to install the corresponding dependent libraries.
Application. After installing dependencies, you can run applications separately from each slave operating system, so that the applications are isolated from each other.
Understanding Docker containers
When running multiple isolated applications using the Docker container, as shown below:
It is not difficult to find that Docker is much simpler than virtual machines. Because we don't need to run a bloated slave operating system anymore.
Understand the image above from bottom to top:
Infrastructure (Infrastructure).
The main operating system (Host Operating System). All major Linux distributions can run Docker. For MacOS and Windows, there are also ways to "run" Docker.
Docker daemon (Docker Daemon). Instead of Hypervisor, the Docker daemon is a background process that runs on the operating system and is responsible for managing the Docker container.
All kinds of dependencies. For Docker, all dependencies of the application are packaged in the Docker image, and the Docker container is created based on the Docker image.
Application. The source code of the application and its dependencies are packaged in a Docker image, and different applications require different Docker images. Different applications run in different Docker containers, and they are isolated from each other.
Compare virtual machine with Docker
The Docker daemon can communicate directly with the main operating system and allocate resources to individual Docker containers; it can also isolate containers from the main operating system and separate containers from each other. It takes several minutes for the virtual machine to start, while the Docker container can start in milliseconds. Without bloated slave operating systems, Docker can save a lot of disk space and other system resources.
After talking so much about the advantages of Docker, there is no need to completely negate virtual machine technology, because the two have different usage scenarios. Virtual machines are better at completely isolating the entire operating environment. For example, cloud service providers often use virtual machine technology to isolate different users. Docker is often used to isolate different applications, such as front-end, back-end, and databases.
At this point, I believe you have a deeper understanding of "what's the difference between virtual machine and Docker". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.