x86架构机器上运行arm64 docker(跨平台构建 Docker 镜像)

docker 启动报错

standard_init_linux.go:211: exec user process caused "exec format error"

由于镜像不是自己做的,查看镜像的元数据

[root@localhost ~]# docker inspect 637870cdd04a
...
        "Architecture": "arm64",
        "Os": "linux",
...

看到镜像是arm64架构,而宿主机是x86_64架构
问题核心变成了跨平台启动 Docker 镜像

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

ARM,AMD,X86,AArch64的概念可以看博客:https://blog.csdn.net/Bubbler_726/article/details/88397357

不更换宿主机系统情况下,个人具体解决操作步骤
1、下载qemu

wget https://github.com/multiarch/qemu-user-static/releases/download/v5.1.0-2/qemu-aarch64-static.tar.gz

2、启动qemu

docker run --rm --privileged multiarch/qemu-user-static:register

3、运行arm容器

docker run -it -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static 637870cdd04

参考转自链接:https://blog.csdn.net/xiang_freedom/article/details/92724299

你可能感兴趣的:(docker,linux,centos,运维,服务器)