发布时间: 2024-7-22 文章作者: myluzh 分类名称: Kubernetes 朗读文章
root@iZbp12bkuvg20e1j3y9gtxZ:~# vi upload_rancher_images.sh #!/bin/bash # 获取前缀rancher开头的镜像 images_info=$(docker images | grep '^rancher' | awk '{print $1, $2, $3}') registry='172.30.82.223:5443/' # 登录harbor私有仓 docker login "$registry" # 按行遍历镜像信息 echo "$images_info" | while read -r image_name image_version image_id; do # 打上标签 然后上传到私有仓 echo "镜像名: $image_name 版本: $image_version ID: $image_id" docker tag "$image_name:$image_version" "$registry$image_name:$image_version" docker push "$registry$image_name:$image_version" echo "" done root@iZbp12bkuvg20e1j3y9gtxZ:~# chmod +x upload_rancher_images.sh root@iZbp12bkuvg20e1j3y9gtxZ:~# ./upload_rancher_images.sh
标签: docker rancher harbor push
发表评论