The evolution of traditional deployment projects and the value of Docker

For example, I did the development of a traditional project, such as a shopping website, and finally packaged it into a war package and deployed it on Linux, but the cost is very high, because in order to deploy a user volume, it is not a big shopping. For the website, you need to buy a machine and deploy applications on it, and it only uses a relatively small resource corresponding to your system. At this time, you will find a waste of resources, and the cost of buying a machine is relatively comparative. High, and if you want to migrate to other machines, you will find compatibility issues.

Traditional VM Ware

The solution is to virtualize the physical machine, then install the operating system in the virtual machine, and then deploy our application on it to isolate the resources of our entire physical machine.

img

For example, infrastructure (infrastructure), and then install the operating system (Operation System) on this infrastructure, and then select a virtualization technology (Hypervisor), use VMs for virtualization on this basis, and then go in each VM Install the corresponding operating system, at this moment, to a certain extent, the original hardware resource can be fully utilized.

But at this time, there is a situation that your computer has an 8-core cpu and 16G memory. At this time, when you turn on a VM, it will find your host to apply for a 2-core cpu resource and 4G memory. At this time, this virtual machine may be The APP A in the VM may not always be able to use all of this resources, and all resources will be wasted. Because the VM needs so many resources to support the internal Operating System (operating system), it is quite heavy. of.

Docker

Can we build something similar to JVM (compile once, run everywhere) according to different operating systems, Docker Engine, Docker Engine helps us shield different operating systems, which can facilitate our transplantation.

Docker deploying an application is equivalent to a new Java object, Docker Engine is equivalent to JVM, any application deployed by Docker is equivalent to a class template and an object. The applications or resources you deploy in Docker can be considered as Docker image templates. , And the Java objects you create based on each image can be understood as Containers, and a Docker Image can create multiple Containers.

This is a containerized technology. Any application you run can contain a resource that can be called a container. The previous JVM shared a physical host resource no matter how many objects it instantiated.

And if you need many resources for Docker's Container, you need resources directly with the physical host, so the advantage of this design is that Containers directly share the physical host resources, and you don't need VM Ware. This way, you can directly find the host for resources when you start it, so Docker takes up The resources are relatively small.

img

The bottom layer is Infrastructure, then the installed operating system (Host Operation System), and then the Docker engine. Each APP is actually a Container, and one Container runs on Docker. Each Container is based on Docker. Image template to create it.

For example, to deploy a project, first the code configuration file depends on the environment, becomes Docker Image, and then becomes Containers. If Redis is installed, it becomes Docker Image first, and finally becomes Containers. If Tomcat is installed, it also becomes Containers first. Image, finally becomes Containers

The main purpose of Docker

  1. Provide a one-time environment. For example, local testing of other people's software, continuous integration to provide unit testing and construction environment.

  2. Provide flexible cloud services. Because Docker containers can be opened and closed at any time, it is very suitable for dynamic expansion and contraction.

Build a microservice architecture. A microservice will have many apps, and the Docker deployment method is the most suitable.

Guess you like

Origin blog.csdn.net/qq_41489540/article/details/114017203