码迷,mamicode.com
首页 > 其他好文 > 详细

harbor仓库镜像的删除

时间:2017-09-06 14:32:50      阅读:410      评论:0      收藏:0      [点我收藏+]

标签:layer   name   file   actual   out   art   raw   shel   enable   

harbor仓库镜像的删除

刚开始自己摸索了下,直接webui界面删除后,发现仓库空间未释放

上传之前仓库空间占用为

技术分享

上传之后仓库空间占用为

技术分享

在webui界面上删除镜像后

技术分享

查看大小

技术分享

依旧为286m,到是什么原因呢,通过官方github查看使用文档,终于找到了解决办法,那就是在webui删除镜像是软删除,并不会释放空间,在

webui界面删除后必须停止harbor后再进行硬删除,也就是空间释放,垃圾回收,下面是官方文档原文

Deleting repositories

Repository deletion runs in two steps.

First, delete a repository in Harbor‘s UI. This is soft deletion. You can delete the entire repository or just a tag of it. After the soft deletion, the repository is no longer managed in Harbor, however, the files of the repository still remain in Harbor‘s storage.

技术分享技术分享

CAUTION: If both tag A and tag B refer to the same image, after deleting tag A, B will also get deleted. if you enabled content trust, you need to use notary command line tool to delete the tag‘s signature before you delete an image.

Next, delete the actual files of the repository using the registry‘s garbage collection(GC). Make sure that no one is pushing images or Harbor is not running at all before you perform a GC. If someone were pushing an image while GC is running, there is a risk that the image‘s layers will be mistakenly deleted which results in a corrupted image. So before running GC, a preferred approach is to stop Harbor first.

Run the below commands on the host which Harbor is deployed on to preview what files/images will be affected:

$ docker-compose stop

$ docker run -it --name gc --rm --volumes-from registry vmware/registry:2.6.2-photon garbage-collect --dry-run /etc/registry/config.yml

NOTE: The above option "--dry-run" will print the progress without removing any data.

Verify the result of the above test, then use the below commands to perform garbage collection and restart Harbor.

$ docker run -it --name gc --rm --volumes-from registry vmware/registry:2.6.2-photon garbage-collect  /etc/registry/config.yml

$ docker-compose start

For more information about GC, please see GC.

官方已经说的很明白了,第一个run是只打印出来已删除镜像,但不进行空间释放和垃圾回收,执行下面的一个run,成功释放空间了。

技术分享

执行垃圾回收命令 docker run -it --name gc --rm --volumes-from registry vmware/registry:2.6.2-photon garbage-collect  /etc/registry/config.yml 自行参照镜像名称修改

技术分享

释放过程截图

启动harbor

技术分享

查看空间是否释放

技术分享

 

我们的空间回来了

再上传一次试试?

技术分享

证明没问题,可以上传。

也可以下载

技术分享

至此,仓库空间释放,垃圾回收告一段落

附上官方文档地址

https://github.com/vmware/harbor/blob/master/docs/user_guide.md

 

harbor仓库镜像的删除

标签:layer   name   file   actual   out   art   raw   shel   enable   

原文地址:http://www.cnblogs.com/hh2737/p/7484313.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!