kubernetes - 关于docker镜像使用docker save命令打包出来的文件的完整性
天蓬老师
天蓬老师 2017-04-25 09:03:12
0
2
809

需求:现在碰到一个需求,需要定期轮休某个目录,将其中的.tar文件使用docker load命令加载镜像

问题1:显然.tar文件要是使用 docker save 镜像名:版本 > abc.tar 这种形式打包出来的,才能被成功load回去。那么该如何检测.tar文件是否格式正确,且镜像内容完整。这样就能够将那些非docker save出来的文件删除。

问题2:该目录是需要用户上传.tar文件的。考虑到一些镜像save出来的.tar文件很大,那么上传的时间会比较多,如何判断某个.tar文件正是正在上传的,这样就不会将它删掉了。

不知道我表达清楚没有,各位大侠有什么好方法。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all (2)
小葫芦

docker saveThe exported file is actually an ordinary compressed file. This compressed file contains all the image layers of the image, as well as the Manifest file containing the basic information of the image. The Manifest file contains hash values of all image layers. You can use these feature values to check whether the image layer file is complete and correct. You can determine whether the exported data of the image is correct by checking the contents of the Manifest file and all image layer files.

    大家讲道理
    1. Not sure, the official document doesn’t mention the issue of verification(refer to @有明’s answer)

    2. There are many ways to ensure that, for example, the actual upload directory is separated from your working directory (upload to /upload, then move to /publish after completion, you will only delete the ones under /publish), or after uploading the file Bring a .md5sum verification file. If the .md5sum verification file does not exist, it means the file has not been uploaded yet

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!