将harbor仓库镜像迁移至另一台harbor仓库服务器
生活随笔
收集整理的这篇文章主要介绍了
将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仓库服务器的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: (网址收藏)Golang模块之HTTP
- 下一篇: centos7 yum安装docker