Regarding the integrity of files packaged by the docker save command for dockermirror images

  docker, question

Requirement: Now I meet a requirement that I need to periodically rotate a directory and load the. tar file into the image using the docker load command.

Question 1: obviously. tar files can only be successfully load back if they are packaged in the form of docker save image name: version > abc.tar. Then how to detect if the. tar file is in the correct format and the mirror image is complete? In this way, files that are not docker save can be deleted.

Question 2: This directory requires users to upload. tar files. Considering that the. tar file save by some images is very large, it will take more time to upload. how to judge that a. tar file is being uploaded, so it will not be deleted.

I don’t know if I have expressed myself clearly, what good methods do you have?

docker saveThe exported file is actually an ordinary compressed file, which contains all the mirror layers of the mirror and the Manifest file containing the basic information of the mirror. In the Manifest file, hash values of all mirror layers are included, which can be used to check whether the mirror layer file is complete and correct. You can check the contents of the Manifest file and all the mirror layer files to determine whether the exported data of the mirror is correct.