docker 不同架构镜像融合问题解决

1、背景

docker 作为目前容器的标准之一,但是对于多种架构的平台的混合编译支撑不是很好。因此衍生了镜像融合,分别将多种不同的架构构建好,然后将镜像进行融合上传。拉取镜像的会根据当前系统的架构拉取不同的镜像,也可以通过 --platform 指定什么类型的架构。

2、处理流程

注意:这里使用的 http 类型的 harbar 服务,如果不是请去除参数 --insecure

bash 复制代码
# 构建 arm 镜像
docker build -t registry.xx/public/test-arm:v1.0 -f test-arm.Dockerfile
# 构建 amd 镜像
docker build -t registry.xx/public/test-amd:v1.0 -f test-amd.Dockerfile
# 镜像融合
docker manifest create --insecure --amend registry.xx/public/test:v1.0 registry.xx/public/test-arm:v1.0 registry.xx/public/test-amd:v1.0
# 镜像上传
docker manifest push --insecure registry.xx/public/test:v1.0

3、问题

3.1 docker manifest create is only supported on a Docker cli with experimental cli features enabled

需要开启参数 experimental,只有 docker v20.xx.xx 版本之前的需要,后续版本默认开启该参数。

需要在两个地方加上参数

bash 复制代码
[root~]# cat /etc/docker/daemon.json
{
    
    "insecure-registries" : ["registry.xx"],
    "experimental": true
}

[root~]# cat ~/.docker/config.json
{
	"auths": {
		"registry.xx": {
			"auth": "xxxxxx"
		}
	},
	"experimental": "enabled"
}[ro

3.2 failed to configure transport: error pinging v2 registry: Get https://registry.xx/v2/: http: server gave HTTP response to HTTPS client

如果使用的是 https 的 harbor 则没有下面问题

docker 20.xx.xx 版本存在如下bug

https://github.com/docker/cli/pull/2376

请将docker 版本升级到 20.xx.xx 或者以上

相关推荐
萧瑟余晖2 小时前
Dubbo SPI扩展机制详解
架构·dubbo
Shulex2 小时前
面向跨境电商多渠道消息系统的技术架构:亚马逊站内信合规对接与自动化执行链路设计
运维·架构·自动化
bloglin999992 小时前
vmware部署centos7启动docker容器后无法访问服务
运维·docker·容器
吴建旭 智宅焕3 小时前
AI搜索时代的智能家居交付知识架构:官网作为可信一手信息源与全国交付基础设施
人工智能·架构·智能家居
孟健4 小时前
出海开发者资金合规:从港卡结汇到完税申报实操
后端·架构
梦帮科技4 小时前
领域认知知识库图谱注入:从双式记账图网络到高质量问答对自动化合成流水线
运维·网络·数据库·人工智能·矩阵·架构·自动化
海宇服务4 小时前
零信任架构实战:基于海宇车型识别精准构建自动化定损网关
运维·人工智能·架构·自动化
悟天特斯5 小时前
边缘计算赋能楼宇智能化:云边协同的实时闭环与自治架构
人工智能·架构·边缘计算
爱学习的程序媛6 小时前
2. 智能应用开发技术栈清单
ai·架构·系统架构·ai应用·智能体开发·智能应用开发
m0_587383006 小时前
24小时自助健身房软硬件解决方案实战指南:从架构设计到部署实施
java·spring·小程序·架构·需求分析