简介:

Harbor私有仓库运行一段时间后,仓库中存有大量镜像,会占用太多的存储空间。直接通过Harbor界面删除相关镜像,并不会自动删除存储中的文件和镜像。需要停止Harbor服务,执行垃圾回收命令,进行存储空间清理和回收。

相关资料:

1、Harbor用户手册中的相关说明:

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:

#要启用垃圾回收(GC),首先要关闭Harbor服务,然后再执行清理命令

#停止Harbor相关服务

$ docker-compose stop

#使用--dry-run参数运行容器,预览运行效果,但不删除任何数据

$ 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.

#不使用--dry-run参数,将删除相关的文件和镜像,

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

#重新启动Harbor相关服务

$ docker-compose start

图1:01-先在Harbor UI图形界面中删除不需要的镜像

图2:02-停止Harbor服务,执行垃圾回收命令

2、数人云CTO肖总微信公号的文章:

图3:老肖说两句截图

图4:数人云CTO肖总-微信公众号-老肖说两句

参考链接:

Harbor用户指南

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

删除容器镜像仓库中的容器镜像到底有多难?

http://mp.weixin.qq.com/s?__biz=MzA4ODgwNTk1NQ==&mid=2649949694&idx=1&sn=eda4513942458714a1eb89aaa25c9954&chksm=882322d2bf54abc4cb4e5c37fe348e2849c14f3d7e2897a0d839a045d8789640a1b99ca26d44&mpshare=1&scene=2&srcid=0226hpbvbowRZphA0jkqkTlq&from=timeline#rd

Garbage collection

https://github.com/docker/docker.github.io/blob/master/registry/garbage-collection.md

Harbor私有仓库中如何彻底删除镜像释放存储空间?的更多相关文章

  1. 删除docker私有仓库中的镜像

    1.搭建私有仓库 (1)拉取私有仓库镜像 docker pull registry(2)启动私有仓库容器 docker run ‐di ‐‐name=registry ‐p 5000:5000 reg ...

  2. 在jenkins中使用shell命令推送当前主机上的docker镜像到远程的Harbor私有仓库

    1.jenkins主机上的docker配置 先在Jenkins主机的docke上配置上Harbor私有仓库地址 cat /etc/docker/daemon.json { "insecure ...

  3. 配置 Containerd 在 harbor 私有仓库拉取镜像

    官方文档地址:https://github.com/containerd/cri/blob/master/docs/registry.md 严格来说,这个具体可分为两部分 1.在k8s中使用Conta ...

  4. 一步步搭建docker私有仓库并从私有仓库中下载镜像

    一步步搭建docker私有仓库 #下载镜像 docker pull registry#查看镜像 docker images #运行私有仓库,指定端口和数据卷 docker run -d -p : -v ...

  5. 部署 harbor 私有仓库

    安装下载依赖包 安装docker-compose 从 docker compose 发布页面下载最新的 docker-compose 二进制文件,本文以1.25.4为例 cd /opt/k8s/wor ...

  6. Docker Harbor私有仓库部署与管理 (超详细配图)

    Docker Harbor私有仓库部署与管理 1.Harbor 介绍 2.Harbor部署 3.Harbor管理 1.Harbor 介绍: 什么是 Harbor ? Harbor 是 VMware 公 ...

  7. Centos7搭建Harbor私有仓库(二)

    1 说明 前文Centos7搭建Harbor私有仓库(一)中成功搭建了Harbor,但,是以http方式搭建的,这里我们修改为https方式 以下基于镜像CentOS-7-x86_64-Minimal ...

  8. 创建Harbor私有仓库

    前提 1.安装docker服务 参考:https://blog.csdn.net/weixin_36522099/article/details/108861134 老名字:docker.docker ...

  9. 搭建harbor私有仓库

    2-1.项目说明  Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,由VMware开源,其通过添加一些企业必需的功能特性,例如安全.标识和管理等,扩展了开源 Docke ...

随机推荐

  1. nessus无法访问https://localhost:8834/#/,解决方法。

    之前没弄明白为啥经常访问不了https://localhost:8834/#/,后面才发现是服务关闭了. 首先netstat -an 查看8834是否开启, 直接运行一下nessus目录下的nessu ...

  2. 【托业】【新东方全真模拟】03~04-----P5~6

    ❤  customer satisfaction survey 客户满意度调查 ❤  lose + 宾语:be lost ❤  superior (在品质上)更好的 ❤  be entitled to ...

  3. SpringBoot-@RequestParam

    Request参数 在访问各种各样网站时,经常会发现网站的URL的最后一部分形如:?xxxx=yyyy&zzzz=wwww.这就是HTTP协议中的Request参数,它有什么用呢?先来看一个例 ...

  4. WIN7搭建ASP站点

    在WIN7配置IIS用于搭建ASP站点(非ASP.NET) ,仅安装.配置必要文件. 1.安装IIS管理工具,用于支持静态页面. 2.添加匿名访问权限. 搭建站点指定到特定文件夹,浏览静态页面会报如下 ...

  5. 【学习笔记】Tensorflow+Inception-v3训练自己的数据

    导读 喵喵的,一个大坑.本文分为吐槽和干货两部分. 一.吐槽 大周末的,被导师扣下加班,嗨气,谁叫本狗子太弱鸡呢,看起来很简单的任务倒腾了两天还没完,不扣你扣谁? 自己刚接到微调Inception-v ...

  6. (转)Linux vi 命令大全

    进入vi的命令 vi filename :打开或新建文件,并将光标置于第一行首 vi +n filename :打开文件,并将光标置于第n行首 vi + filename :打开文件,并将光标置于最后 ...

  7. JavaScript 事件之event.preventDefault()与event.stopPropagation()简单介绍

    event.preventDefault()用法介绍: 该方法将通知 Web 浏览器不要执行与事件关联的默认动作(如果存在这样的动作). 例如,如果 type 属性是 “submit”,在事件传播的任 ...

  8. C#构造函数、私有构造函数、静态构造函数与构造函数执行顺序

    默认构造函数,如果没有为类指定任何构造函数,编译器会自动为类创建一个无参构造函数,用以初始化类的字段:如果为类编写了构造函数,那么编译器就不会再自动生成无参构造函数了.ps.C#不允许用户为结构定义无 ...

  9. Docker 推送镜像到hub.docker

    1.Docker镜像文件:lails.server.demo:1.0, 2.登录Docker:docker login[根据提示输入用户名/密码] 3.执行:docker push lails.ser ...

  10. sql server 按年月日分组

    sql server  按年月日分组 ----------------------------------------------- --author:yangjinwang --date:2017- ...