Harbor私有仓库中如何彻底删除镜像释放存储空间?
简介:
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服务,执行垃圾回收命令
相关文章
- maven镜像还有不支持发型版本5
- 使用LightHouse Docker基础镜像部署Minecraft服务器
- Docker镜像
- Java 革新之路:GraalVM 原生镜像
- 如何搭建代理镜像仓库
- 如何搭建镜像网站_模拟网站的主页地址怎么打开
- Docker镜像实践
- Docker容器实战八:镜像管理命令
- 小记:如何将 Logstash7 镜像替换为 KonaJDK
- 【Docker学习教程系列8-如何将本地的Docker镜像发布到私服?
- 如何清理Docker容器、镜像、数据卷和网络
- 安装Linux镜像:简单实用指南.(如何安装linux镜像)
- 实现自主:如何制作 Linux 镜像(制作linux镜像)
- 如何创建一个 Docker 镜像
- 如何打造更小巧的容器镜像
- 如何构建 Fedora 容器镜像
- 硬核观察 | macOS 式的 BSD 桌面操作系统 helloSystem 发布新镜像
- 免费开源的视频专区,开源镜像, 免费图库, 建站程序, 设计资源, 学习专区, UI组件库网站分享
- 下载Oracle镜像,让你理解数据库更轻松(oracle镜像下载)
- 如何实现 MySQL 镜像同步?(mysql镜像同步)
- 如何利用阿里云镜像优化Linux系统?(阿里云镜像linux)
- 实施mssql镜像服务器,提供最大化的分离性(mssql镜像服务器分离)
- 利用Linux搭建高效的镜像服务器(linux镜像服务器)
- 教程如何在中国下载MySQL国内加速器(mysql下载国内镜像)
- 快速构建Redis集群使用镜像安心下载(redis集群镜像下载)
- 让你快速掌握Redis镜像的简易教程(redis镜像教程)
- 如何阻止网站被恶意反向代理访问(防网站镜像)