找了有两个开源项目比较不错,都可以完成镜像的迁移。

crpy 的使用

crpy 使用 python 开发,有本地缓存,拉取和推送镜像速度比较快。使用体验比较接近 docker。
开源地址: https://github.com/bvanelli/crpy

安装

1
2
# 也可以安装到虚拟环境
pip install crpy

认证

1
crpy login registry.cn-hangzhou.aliyuncs.com -u <username> -p <password>

认证信息存储在:~/.crpy/config.json

拉取镜像

1
crpy pull nginx:1.29 nginx_1.29.tar.gz

缓存数据存储在:~/.crpy/blobs

推送镜像

1
crpy push nginx_1.29.tar.gz registry.cn-hangzhou.aliyuncs.com/iuxt/nginx:1.29

crane 的使用

这个工具是 Golang 写的,支持 Windows,单文件直接运行,比较方便。
https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md

安装

在:https://github.com/google/go-containerregistry/releases 下载二进制文件即可。

认证

1
crane auth login registry.cn-hangzhou.aliyuncs.com -u <username> -p <password>

认证信息存储在:~/.docker/config.json

拉取镜像

1
crane pull nginx:1.27 nginx_1.27.tar

推送镜像

1
crane push .\nginx_1.27.tar registry.cn-hangzhou.aliyuncs.com/iuxt/nginx:1.27