将harbor仓库镜像迁移至另一台harbor仓库服务器
生活随笔
收集整理的這篇文章主要介紹了
将harbor仓库镜像迁移至另一台harbor仓库服务器
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
# jq是用來(lái)解析json的包,需要提前安裝
[root@master1 harbor-migration]# yum install -y jq#完整腳本內(nèi)容
[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]#
執(zhí)行過(guò)程演示:
參考鏈接:
https://blog.csdn.net/zsy_1991/article/details/101029404
總結(jié)
以上是生活随笔為你收集整理的将harbor仓库镜像迁移至另一台harbor仓库服务器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: (网址收藏)Golang模块之HTTP
- 下一篇: docker报错:OCI runtime