docker 镜像迁移

Last updated on November 20, 2024 am

🧙 Questions

解决外网镜像无法下载问题

☄️ Ideas

docker pull spark:3.4.1
error pulling image configuration: Get https://production.cloudflare.docker.com/registry-v2/docker/registry/v2/blobs/sha256/31/31ed15daa2bf7f194b0a211f7c2a65acc3a671a3d9afd9290691bc68e3f67bbd/data?verify=1721099683-S9jdvSiEPxGjk7e%2Bsstnd%2BQ1LKQ%3D: dial tcp 108.160.165.189:443: i/o timeout
外网下载镜像

20240716105356

# 联网下载镜像
docker pull --platform=linux/amd64 quay.io/jetstack/cert-manager-ctl:v1.15.1
docker pull --platform=linux/arm64 spark:3.4.1
docker pull --platform=linux/arm64 flink:1.18.1-scala_2.12
docker pull --platform=linux/amd64 flink:1.18.1-scala_2.12

# 登陆阿里账号
docker login --username=ispong registry.cn-shanghai.aliyuncs.com

# 查询镜像imageId
docker images

# 打标签
docker tag 51ac287c39fd registry.cn-shanghai.aliyuncs.com/isxcode/spark:3.4.1-amd64
docker tag f74a7b9a2b18 registry.cn-shanghai.aliyuncs.com/isxcode/spark:3.4.1-arm64
docker tag 406fe9cf2bc5 registry.cn-shanghai.aliyuncs.com/isxcode/flink:1.18.1-scala-2.12-arm64

# 推送到阿里云镜像
docker push registry.cn-shanghai.aliyuncs.com/isxcode/spark:3.4.1-amd64
docker push registry.cn-shanghai.aliyuncs.com/isxcode/flink:1.18.1-scala-2.12-arm64
拉取镜像
docker pull registry.cn-shanghai.aliyuncs.com/isxcode/spark:3.4.1-amd64
docker images | grep 3.4.1-amd64
docker tag 51ac287c39fd spark:3.4.1
镜像导出

注意名称不能用冒号

docker save -o /Users/ispong/Downloads/spark-3.4.1-amd64.tar registry.cn-shanghai.aliyuncs.com/isxcode/spark:3.4.1-amd64
镜像导入
docker load -i spark-3.4.1-amd64.tar
# Loaded image: registry.cn-shanghai.aliyuncs.com/isxcode/spark:3.4.1-amd64
远程迁移
docker pull --platform=linux/amd64 rancher/kubectl:v1.20.2
docker save -o /Users/ispong/Downloads/1.tar rancher/kubectl:v1.20.2
scp 1.tar root@xxx:/tmp
docker load -i 1.tar
docker tag rancher/kubectl:v1.20.2 isxcode:8443/library/rancher/kubectl:v1.20.2
docker push isxcode:8443/library/rancher/kubectl:v1.20.2

docker 镜像迁移
https://ispong.isxcode.com/kubernetes/docker/docker 镜像迁移/
Author
ispong
Posted on
July 16, 2024
Licensed under