Why do SpringBoot-2.3 mirroring solutions have multiple layers

background

  1. In the article "Experiencing SpringBoot (2.3) Application Making Docker Mirror (Official Solution)" , we experienced the official recommended mirroring solution, executed the docker history command to observe the inside of the mirror, and found that it is composed of multiple layers, as shown in the following figure:
    Insert picture description here
  2. Here comes the question: what do you do with so many layers? Next, in the form of graphics and text, you will understand the role of docker image layer for java developers;

statement

The goal of this article is to help Java developers understand the layer function of docker mirroring through graphics and text. The content is not completely consistent with the actual situation. For example, the layer of the basic mirror is not mentioned, and the layer of the Java mirror may not only include business mirrors, configuration files, Depend on the three layers of the library;

Common roles

When using docker, there are three common roles:

  1. Mirroring by: herein is SpringBoot application developer, to finish the application of the code image made docker;
  2. Docker public mirror warehouse: The mirror maker pushes the mirror to the warehouse for everyone to use;
  3. Mirror user: download the mirror from the mirror warehouse to local use;

The following story revolves around the above three roles;

The process from production to use

  1. As shown in the figure below, a SpringBoot application developer, after writing the code, turns the application into a docker image. The TAG of the image is 1.0. At this time, when the developer pushes the image to the public warehouse, a total of three layers must be pushed:
    Insert picture description here
  2. Next, if the user wants to download the mirror, he downloads three layers from the mirror repository:
    Insert picture description here
  3. At this time, the content of the three characters are all the same, and they are all three layers:
    Insert picture description here
  4. At this time, the SpringBoot developer modified the business code and made a new mirror (TAG is 2.0), and then pushed it to the mirror warehouse;
  5. Here comes the point : because only the business code is changed, only the layer of the business class is new, and only this layer will be pushed to the warehouse, as shown below:
    Insert picture description here
  6. For mirror users, if you have downloaded a 1.0 mirror before, if you want to use a 2.0 mirror at this time, you only need to download the latest service class layer from the warehouse:
    Insert picture description here
  7. The final result is as follows. Both public warehouses and mirror users have obtained 2.0 mirrors at the least cost: It
    Insert picture description here
    can be seen that using multiple layer mirrors in the distribution process of mirrors will be more efficient than single-layer mirroring, especially when using hubs. Public warehouses on the Internet like .docker.com, and in scenarios where new versions are frequently released;

Welcome to my GitHub

  • Address: https://github.com/zq2599/blog_demos
  • Content: Classification and summary of original articles, and supporting source code, involving Java, Docker, K8S, DevOPS, etc.;

Welcome to follow my public account: programmer Xin Chen

Insert picture description here

Guess you like

Origin blog.csdn.net/boling_cavalry/article/details/106600620