How is the Dockerfile cached when it generates a mirror?

  docker, question

For example, it takes me two hours to install a thing, but it will take him very soon to build it again after the construction is successful, indicating that it is cached. Now I wonder how to ensure that if I change something a little, it does not take another two hours.

In the docker build process, every RUN command is executed to generate a mirror image. In addition, the mirrors are related by blood. Whether you need to recompile for two hours depends on how early the first mirror image affected by your modification is.
Simple Understanding When You Modify dockerfile, When You ModifyThe RUN command on line n and the commands after N+1 should be rerun.;

Docker image --tree # View Mirror Dependencies
 In addition, you can also see many mirror files with None name directly in docker images.
 That is the result of your previous build.  If build succeeds, None will be changed to the name you specify;