欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

将harbor仓库镜像迁移至另一台harbor仓库服务器

发布时间:2025/1/21 编程问答 33 豆豆
生活随笔 收集整理的这篇文章主要介绍了 将harbor仓库镜像迁移至另一台harbor仓库服务器 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
# jq是用来解析json的包,需要提前安装 [root@master1 harbor-migration]# yum install -y jq#完整脚本内容 [root@master1 harbor-migration]# pwd /opt/harbor-migration [root@master1 harbor-migration]# cat harbor-migration.sh #!/bin/sh source_registry=$1 target_registry=$2 username=admin password=adminpwd#!/bin/sh image_names=`curl -u $username:$password http://$source_registry/v2/_catalog 2>/dev/null|jq .repositories[]|tr -d '"'` for i in $image_names do echo $itags=`curl -u $username:$password http://$source_registry/v2/$i/tags/list 2>/dev/null|jq ".tags[]"|tr -d '"'`echo $tagsfor j in $tagsdoecho $jdocker pull $source_registry/$i:$jdocker tag $source_registry/$i:$j $target_registry/$i:$jdocker push $target_registry/$i:$jdone done[root@master1 harbor-migration]# hostname -i 192.168.116.101 [root@master1 harbor-migration]#

执行过程演示:

参考链接:
https://blog.csdn.net/zsy_1991/article/details/101029404

总结

以上是生活随笔为你收集整理的将harbor仓库镜像迁移至另一台harbor仓库服务器的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。