Introduction to Docker containerization technology (1) Introduction to Docker

foreword

The core content comes from video link 1. I hope everyone will support the author a lot.
This article is used for recording to prevent forgetting

(1) Introduction to Docker

1 What is Docker?

1.1 The emergence of Docker

  • Question: Why does docker appear?

Suppose you are developing an online store, you are using a laptop and your development environment has a specific configuration. Other developers are also in different environment configurations. The application you are developing depends on your current configuration and also depends on certain configuration files. Additionally, your enterprise has standardized test and production environments with its own configuration and set of supporting files. You want to emulate as many of these environments locally as possible without incurring the overhead of recreating the server environment. (that is, the development and deployment environments are inconsistent)

The question is: how do you ensure that your application will run and pass quality testing in these environments? And without versioning headaches, configuration headaches, re-coding and bug-fixing during deployment?

The answer is to use containers. The reason why Docker develops so rapidly is also because it provides a standardized solution for this - smooth system migration and container virtualization technology.

The environment configuration is quite troublesome. If you change a machine, you have to do it all over again, which is laborious and time-consuming. Many people think, can the problem be solved fundamentally, and the software can be installed with the environment ? That is to say, when installing, copy the original environment exactly. With Docker, developers can eliminate the "works on my machine" problem when co-coding.

insert image description here
Before configuring an application operating environment on the server, various software needs to be installed. Take the e-commerce project environment as an example, Java/RabbitMQ/MySQL/JDBC driver packages are required. Not to mention how troublesome it is to install and configure these things, it is not yet cross-platform. If we installed these environments on Windows, we would have to reinstall them on Linux. Moreover, even if the operating system is not crossed, it is very troublesome to transplant the application to another server with the same operating system.

It is traditionally believed that after software coding development/testing is completed, the output is a program or a binary bytecode that can be compiled and executed (java as an example). In order for these programs to be executed smoothly, the development team must also prepare complete deployment files so that the operation and maintenance team can deploy the application. The development needs to clearly inform the operation and maintenance deployment team of all configuration files + all software environments used. Even so, however, deployment failures often occur . The emergence of Docker has enabled Docker to break the past concept of "programs as applications". Except for the core of the operating system through images, the system environment required to run the application is packaged from bottom to top to achieve seamless cross-platform operation of the application .

1.2 The concept of Docker

Docker is a cloud open source project based on the Go language .
The main goal of Docker is "Build, Ship and Run Any App, Anywhere", which is to make the user's APP (which can be a WEB application or a database application) etc.) and its operating environment can achieve "mirror once, run everywhere" .
insert image description here

The emergence of Linux container technology solves such a problem, and Docker is developed on the basis of it . The application is mirrored, and the mirror becomes an instance running on the Docker container, and the Docker container is consistent on any operating system, which realizes cross-platform and cross-server. You only need to configure the environment once, and you can deploy it on another machine with one click, which greatly simplifies the operation.

1.3 One sentence

A software container that solves the problems of the operating environment and configuration , facilitates continuous integration and contributes to the container virtualization technology of the overall release.

2 Comparing containers with virtual machines

2.1 Brief History of Container Development

insert image description here

insert image description here

2.2 Traditional virtual machine technology

Virtual machine (virtual machine) is a solution with environment installation.
It can run another operating system in one operating system, such as running Linux system CentOS7 in Windows 10 system. The application is not aware of this, because the virtual machine looks exactly the same as the real system, but for the underlying system, the virtual machine is just an ordinary file, which can be deleted when it is not needed, and has no effect on other parts. This type of virtual machine perfectly runs another system, which can keep the logic between the application program, operating system and hardware unchanged.

Traditional virtual machine technology is based on the virtual machine management system (such as: VirtualBox and VMWare, etc.) installed on the main operating system, creating a virtual machine (virtualizing various hardware), installing a secondary operating system on the virtual machine, and creating a virtual machine in the secondary operating system. Install and deploy various applications.

insert image description here
Disadvantages of virtual machines:
1. More resource usage
2. More redundant steps
3. Slow startup

2.3 Container virtualization technology

Due to some shortcomings of the previous virtual machine, Linux has developed another virtualization technology:
Linux Containers (Linux Containers, abbreviated as LXC)
Linux containers are a series of processes isolated from other parts of the system, running from another mirror, And the image provides all the files needed to support the process. The image provided by the container contains all the dependencies of the application, so it is portable and consistent from development to testing to production.

Instead of simulating a complete operating system , Linux containers isolate processes. With containers, it is possible to package all the resources needed for software to run into an isolated container. Unlike virtual machines, Linux containers do not need to be bundled with a complete operating system , but only the library resources and settings required for the software to work. The system thus becomes efficient and lightweight and ensures that the software deployed in any environment can run consistently.
insert image description here

Docker containers implement virtualization at the operating system level and directly reuse the operating system of the local host, while traditional virtual machines implement virtualization at the hardware level. Compared with traditional virtual machines, Docker has the advantages of fast startup speed and small footprint.

2.4 Comparison

  • Traditional virtual machine technology is to virtualize a set of hardware, run a complete operating system on it, and then run the required application process on the system;
  • The application process in the container runs directly on the host's kernel. The container does not have its own kernel and does not perform hardware virtualization . Therefore, containers are more portable than traditional virtual machines.
  • Each container is isolated from each other, and each container has its own file system. The processes between containers will not affect each other, and computing resources can be distinguished.

3 What can Docker do?

(https://img-blog.csdnimg.cn/02e4cf95384b44b6a9169ceaba248ae8.png)

4 Docker download

Guess you like

Origin blog.csdn.net/qq_52358603/article/details/128122046