tech-shrimp / docker_image_pusher

使用Github Action将国外的Docker镜像转存到阿里云私有仓库,供国内服务器使用,免费易用
Apache License 2.0
1.13k stars 6.06k forks source link

发现latest存在多个架构的镜像时只能拉取到x64的 #6

Open david88558855 opened 1 month ago

david88558855 commented 1 month ago

发现latest存在多个架构的镜像时只能拉取到x64的,其他arm架构镜像拉取不到,push后阿里云只存在单一的x64镜像,而不是能拥有多个架构镜像的latest清单,这个有办法改变吗

tech-shrimp commented 1 month ago

我改了下代码 阿里镜像服务个人版并不提供多架构功能,需要在images.txt中用 --platform=xxxxx手动指定镜像架构 指定后的架构会以前缀的形式放在镜像名字前面

多架构
david88558855 commented 1 month ago

虽然阿里个人版没有直接提供多架构 但是 个人版允许创建清单 把多架构清单合并到latest内这样做的结果就是一个latest可以包含多架构镜像 下面是我目前手动创建的方案 请请参考下

拉取 arm64 架构的镜像并且修改标签

docker pull --platform linux/arm64 louislam/dockge:latest && \ docker image tag louislam/dockge:latest registry.cn-hangzhou.aliyuncs.com/8855/dockge:arm64 && \

拉取 x64 架构的镜像并且修改标签

docker pull --platform linux/amd64 louislam/dockge:latest && \ docker image tag louislam/dockge:latest registry.cn-hangzhou.aliyuncs.com/8855/dockge:x64 && \

推送镜像

docker push registry.cn-hangzhou.aliyuncs.com/8855/dockge:arm64 && \ docker push registry.cn-hangzhou.aliyuncs.com/8855/dockge:x64

docker manifest create registry.cn-hangzhou.aliyuncs.com/8855/dockge:latest \ registry.cn-hangzhou.aliyuncs.com/8855/dockge:arm64 registry.cn-hangzhou.aliyuncs.com/8855/dockge:x64 && \ docker manifest push registry.cn-hangzhou.aliyuncs.com/8855/dockge:latest && \ docker manifest rm registry.cn-hangzhou.aliyuncs.com/8855/dockge:latest

manifest create是创建清单 ,manifest push是推送清单 ,manifest rm是清理已经创建的清单

tech-shrimp commented 1 month ago

感谢 有空试试manifest .

lmq8267 commented 1 month ago

虽然阿里个人版没有直接提供多架构 但是 个人版允许创建清单 把多架构清单合并到latest内这样做的结果就是一个latest可以包含多架构镜像 下面是我目前手动创建的方案 请请参考下

拉取 arm64 架构的镜像并且修改标签

docker pull --platform linux/arm64 louislam/dockge:latest && docker image tag louislam/dockge:latest registry.cn-hangzhou.aliyuncs.com/8855/dockge:arm64 && \

拉取 x64 架构的镜像并且修改标签

docker pull --platform linux/amd64 louislam/dockge:latest && docker image tag louislam/dockge:latest registry.cn-hangzhou.aliyuncs.com/8855/dockge:x64 && \

推送镜像

docker push registry.cn-hangzhou.aliyuncs.com/8855/dockge:arm64 && docker push registry.cn-hangzhou.aliyuncs.com/8855/dockge:x64

docker manifest create registry.cn-hangzhou.aliyuncs.com/8855/dockge:latest registry.cn-hangzhou.aliyuncs.com/8855/dockge:arm64 registry.cn-hangzhou.aliyuncs.com/8855/dockge:x64 && docker manifest push registry.cn-hangzhou.aliyuncs.com/8855/dockge:latest && docker manifest rm registry.cn-hangzhou.aliyuncs.com/8855/dockge:latest

manifest create是创建清单 ,manifest push是推送清单 ,manifest rm是清理已经创建的清单

大佬牛逼!试了下,这个命令简单好用 ,感谢分享

Varorbc commented 3 weeks ago

@david88558855 请问我在我的机器上拉了多架构镜像,推送到支持多架构的Harbor服务器后,变成单架构了,能告诉下我该怎么操作能是多架构的嘛,感谢。

roamerxv commented 3 weeks ago

同样问题。 我通过项目拉取了 多平台的 image 但是在 docker-compose 里面用 阿里云的 image 的时候,树莓派上是拉取了 x64 的 image,而不是 arm64