What is docker? What’s the difference between docker and virtual machine

Time:2020-3-25

What is docker
Docker is a software box, or a container, which is isolated from each other for one hour. System level containers, such as a CentOS or an Ubuntu container, can be published anywhere (all kinds of operating systems you are familiar with) and get a virtual running environment of Linux (CentOS or Ubuntu) as long as you build them once. Of course, docker can also provide service level (PHP, go, C + +, etc.) containers, even custom application (a blog, an e-commerce website, etc.) containers.
Note: container technology doesn’t just refer to docker. Docker is quite popular and almost becomes the synonym of container technology.
Suitable for learning
This tutorial is for those who are interested in learning docker as a container service. This product spreads like wildfire in the whole industry, and is influencing the development of new generation applications. So anyone who is interested in learning all aspects of docker should read this tutorial.
Conditions for learning
The prerequisite is that the reader should be familiar with the basic concept of windows and the various programs existing on the windows operating system. In addition, this will help if the reader knows something about Linux.
Start learning docker
Difference between docker and virtual machine
What is docker? What's the difference between docker and virtual machine

virtual machine

  • The virtual opportunity occupies a part of memory and hard disk space. When it runs, other programs cannot use these resources. Even if the application program in the virtual machine uses only memory
    1MB, the virtual machine still needs hundreds of MB of memory to run.
  • There are many redundant steps. Virtual machine is a complete operating system. Some system level steps cannot be skipped, such as user login.
  • Slow startup, how long it takes to start the operating system, and how long it takes to start the virtual machine. It may take a few minutes for the application to actually run.

Docker

  • Fast startup, the application in the container is directly a process of the underlying system, rather than the process inside the virtual machine. Therefore, starting the container is equivalent to starting a process of the machine, rather than starting an operating system, which is much faster.
  • With less resource consumption, the container only takes up the needed resources, not the unused resources; because the virtual machine is a complete operating system, it inevitably takes up all resources. In addition, multiple containers can share resources, and virtual machines are exclusive resources.
  • The volume is small, and the container only needs to contain the components used, and the virtual machine is the packaging of the entire operating system, so the container file is much smaller than the virtual machine file.