What does docker do? What does it have to do with the virtual machine? What are the advantages?

docker

Mar.09,2021

vague questions are often not necessarily a bad one. Although I have been using docker for some time, at first glance, let me answer the difference between docker and ordinary virtual machine, but I really haven't studied it carefully. With this question, I searched for it and probably got some sense. Let me try to give a simple answer as follows:

Docker uses the container technology based on the Linux operating system itself. The container technology is different from the virtual machine in that the container is simply isolated and does not provide very low-level operating system functions, so the system in Docker must be exactly the same or similar to the host operating system. It is a Linux system, and cannot run Windows Docker on the Linux system. For an introduction to LXC, take a look at the article (Docker later switched to runC, but the principle is similar). Generally speaking, this is true, but as Docker's market share grows, manufacturers gradually begin to wonder if they can run different operating systems on different operating systems. For example, the first is Docker? that runs Linux on Windows. This is already possible, and a Docker, running Windows on Linux is now under development, so nothing is absolute.

so what are the benefits of this container technology based on the host operating system? Suppose you have an operating system that takes up 1 gigabyte of hard disk space, and if you use a virtual machine, you need 100 gigabytes of hard disk space to start 100 such virtual machines, while if you use Docker, 1000 containers only take up a little more space than 1 gigabyte, assuming that all 1000 containers use the same operating system. So do you see the difference? In other words, if you need a strictly isolated operating system, then you need to use a virtual machine, but if you don't care whether the underlying operating system is isolated, as long as they work, you can use Docker, because for Docker, the underlying operating system files are shared and do not take up space.

in addition to not taking up space, the startup speed of Docker is also seconds, or even less than a second. If you want to start a virtual machine, it is equivalent to starting a complete operating system, so the startup speed will be slow, but the boot speed of Docker is quite fast.

at the same time in Docker, you can also make your own image based on the original operating system image, assuming that the original operating system image you downloaded is 1G, and you made some changes based on it, adding 50m content, then the new image you created based on it is not 1GB 50m, but only 50m, this is because the bottom layer of Docker helps you to do isolation, your image file only takes up that part of the incremental space. And if you are on the basis of the virtual machine to do the transformation to generate a new virtual machine, then the hard disk takes up at least double the space.

the above is probably the difference between Docker and virtual machine, and what is used needs to be analyzed on a case-by-case basis.


  1. what is docker for?
    should be seen as a deployment environment in which applications / content deployed can be separated from the operating system, which can be seen by the operating system, but not the operating system and other docker containers.
  2. What is the relationship between
  3. and virtual machines?
    the virtual machine must simulate a set of virtual hardware on top of the host to be used by the Guest OS installed in it. Docker is easy to use. Using the off-the-shelf kernel and hardware resources of the host is essentially more like a process with isolation, so it is faster.
    is like a set of desktops. In the past, the whole set had to be sold without dismantling it. After a virtual machine, large pieces of accessories such as mainframe, monitor, keyboard and mouse cover can be sold separately. With docker, the mainframe can also be taken apart and sold, unexpectedly, it can be bought on a board. If it is broken or if you want to upgrade, you used to have to change the whole set together, but now, uh, it can be solved by changing a board directly.
  4. What are the advantages of
  5. ?
    is faster and finer (can isolate individual applications or some resources)

Stack Overflow has an answer that will answer your question.
from-a-normal-virtual-machine" rel=" nofollow noreferrer "> https://stackoverflow.com/que.

Menu