Docker's strengths and weaknesses

Docker problem


As different machines have different operating systems and different libraries and components to deploy an application to require extensive environmental configuration operations on multiple machines. (For example, a case similar to the "no problem on my machine" often appear)

Docker mainly to solve the environment configuration problem, it is a virtualization technology, process isolation, isolated process independent of the host operating system and other isolated process. Use Docker can not modify the application code, the developer does not need to

Learning technologies under certain circumstances, be able to deploy existing applications on other machines, in order to achieve a package, the purpose of multiple deployments.

 

Compared with the virtual machine

VM is a virtualization technology, it Docker biggest difference is that it is by simulating hardware and install the operating system on hardware.

Start-up speed

The virtual machine will need to start the operating system of the virtual machine, and then start the application, this process is very slow.

Start Docker equivalent to a start a process on the host operating system, for the second level.

Footprint

A virtual machine is a complete operating system, you need to take up a lot of disk space, memory and CPU resources;

Docker's just a process, just to packaged applications and related components, consumes very little resources at run time, you can turn thousands of Docker on a single machine.

Mirror container

Mirroring is a static structure, a container can be understood as the source code can be seen as an object-oriented classes, the instance of the container is a mirror (class).

Image contains a code, and other components needed to run the container, which is a layered structure, each layer are read-only (Read-only layers). When constructing a mirror, a layer will be constructed, is the basis of the previous layer after layer, such layered mirroring

Mirror structure is suitable for reuse and customization. When building the container, by adding a base image on the writable layer, for holding the container during the operation of the modification.

 

advantage:

1. ease of deployment

When we initially learn programming, this step up the environment we often have to spend a very long time, which is also a small problem may take a long time to resolve. And then with containers, which are very easy, our development environment only

Is a mirror image of the container or several addresses, the most in need and then a script deployment process execution control, or to further your environment mirrors and mirror script into a Git project published to the cloud when you need to pull it to the local It can be.

# git clone https://github.com/my-project

# sh ./my-build-boot.sh

 

2. Deploy Security

When we receive a bug feedback, a lot of heart when the first reaction is "in my local is good ah, is not your environment a problem?" This happens it is that inconsistent local environment (both also we often say heterogeneous), we debug in the development environment are often not

To ensure that other environmental problems, but have to pay it, the arrival of the vessel, all aspects of unified standards (environment), this will rarely happen. We can develop and test environments and production technologies and to maintain version through the container

Unity depends, to ensure that our code is executed on a highly unified standard, and agreed to testing environment, can also solve the CI (continuous integration) process demands on the environment.

In the growing needs of today's distributed technology and capacity expansion, operation and maintenance can be carried out if the unified arrangements of the environment through the container technology, not only save a lot of time on the deployment, many mistakes can also manually configure the environment generated in the process falls lowest.

3. good isolation

Whether the development or production, often we may have to run on a single machine multiple services, each dependent on the service configuration and different, if there is to say between two applications require the use of the same dependent, or dependent on two applications needed Some of conflict, this

When it is prone to problems, so on the same server different services provided by different applications, it is best to isolate it, and the container in its natural advantage in this regard, each container is an isolated environment there, container internal proposed

Services for the environment depend on the requirements of the container from the inside can provide all this high cohesive performance can be quickly separated from the service in question, in some complex application system to achieve rapid shoot the wrong and immediate treatment.

4. Quick rollback

Before the container rollback mechanism, are generally based on a version of the application redeployment, and replace the current version in question, for the first time, probably flow from development to deployment of a complete, perform this set process often takes a long

Time, Git-based environment, may be rolled back to a history of submission, and then re-deploy, compared with those containers, not fast enough, and may create new problems. Technology and the container with inherently Rollback, because each container or mirror the historical

As is saved, and the replacement of a container or the mirror is very fast and simple.

5. Low cost

This is probably one of the most obvious and useful advantages, and before the vessel appeared, because we tend to build a service, it is necessary to provide a server or a virtual machine, the acquisition cost and operation and maintenance costs of servers are high, and VM occupied

Resources and relatively high, compared to compact and lightweight multi-vessel, constructed just give an internal container-dependent applications will be required, and this is the container technology growing so rapidly the most important reason.

6. Low management costs

With the growing popularity and development of container technology, followed by container management and orchestration technology also been developed, such as Docker Swarm, K8S, Mesos and other containers orchestration tools are constantly updated iteration, which makes container production technology pro-environment

With more possibilities and more space to play, with the use and cost of development and learning environment, docker and other containers are also getting lower and lower, becoming more developers and select corporate.

 

Disadvantages:

 

1. Isolation

Hypervisor-based virtualization technology, the technology in isolation is better than the container, their systems on virtualized hardware resources fully, and when the system level issues a virtual machine appears, tend not to spread to other virtual machines on the same host on, but

Container is not the same, share the same operating system kernel and other components between the container, so by the time other containers such as hacker attacks this case, it is easily influenced by the underlying operating system, even one by one break, resulting in a chain reaction, when

However, this problem can be solved by deploying the container, but the attendant will generate new problems, such as increased cost and performance issues.

 

2. Performance

Whether virtual machines or containers, we are using different techniques to apply themselves to a certain degree of encapsulation and isolation, reducing the coupling between applications and between applications as well as applications and environments on doing a lot of effort, but will comes, it will have

More forwarded through network connections and data exchange, although it will not be obvious at low concurrent systems, but when the same virtual machine or server, the following container requires a higher amount of concurrency support when the issue is complicated by the system become the bottleneck of time , the container

Enlarge this problem, so not all scenes are suitable for container technology.

 

3. Storage solutions

The birth of the container is not abstract for the OS services, which is its biggest difference and the virtual machine, such genes means that the container is inherently more to do for the application environment, telescopic container is also based on the characteristics of the container, and By contrast, requires sustained

Storage solutions on the contrary, the data storage solutions Docker this point the container is formed to provide a mapping volume and transfer data using an interface (storage volume) to achieve the purpose of data persistence. But this will also cause a portion of the resources

Waste and more interactive, whether it is mapped to the host or network disk, are the second best solution.

Reference Links: https://cloud.tencent.com/developer/article/1457282

Guess you like

Origin www.cnblogs.com/fuhuabeihou/p/11534670.html