Docker buildx 报错了,求大神看看

2022-03-09 18:20:56 +08:00
 DaChuiZi
问题遇到的现象和发生背景

buildx 构建多平台运行,中途报错了,dockerfile 中写了 yum install 和这个有关嘛?

问题相关代码
(base) [root@localhost lnmp]# docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t 784066538/lnmpre:1.0 .
[+] Building 383.4s (15/21)                                                                                                                              
 => [internal] booting buildkit                                                                                                                    12.4s
 => => pulling image dockerpracticesig/buildkit:master                                                                                             11.9s
 => => creating container buildx_buildkit_mybuilder-cn0                                                                                             0.5s
 => [internal] load build definition from Dockerfile                                                                                                0.0s
 => => transferring dockerfile: 293B                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                     0.0s
 => [linux/amd64 internal] load metadata for docker.io/lnlingyuan/lnmp-1.7:1.7                                                                      8.3s
 => [linux/arm64 internal] load metadata for docker.io/lnlingyuan/lnmp-1.7:1.7                                                                      8.2s
 => [linux/arm/v7 internal] load metadata for docker.io/lnlingyuan/lnmp-1.7:1.7                                                                     8.2s
 => [auth] lnlingyuan/lnmp-1.7:pull token for registry-1.docker.io                                                                                  0.0s
 => [auth] lnlingyuan/lnmp-1.7:pull token for registry-1.docker.io                                                                                  0.0s
 => [linux/amd64 1/4] FROM docker.io/lnlingyuan/lnmp-1.7:1.7@sha256:2a21a074a384a878ba3e0d4681557b90c7121d21a147f500376832b9b7bb656a                0.0s
 => => resolve docker.io/lnlingyuan/lnmp-1.7:1.7@sha256:2a21a074a384a878ba3e0d4681557b90c7121d21a147f500376832b9b7bb656a                            0.0s
 => [internal] load build context                                                                                                                   0.0s
 => => transferring context: 58.69kB                                                                                                                0.0s
 => [linux/arm64 1/4] FROM docker.io/lnlingyuan/lnmp-1.7:1.7@sha256:2a21a074a384a878ba3e0d4681557b90c7121d21a147f500376832b9b7bb656a                0.0s
 => => resolve docker.io/lnlingyuan/lnmp-1.7:1.7@sha256:2a21a074a384a878ba3e0d4681557b90c7121d21a147f500376832b9b7bb656a                            0.0s
 => [linux/arm/v7 1/4] FROM docker.io/lnlingyuan/lnmp-1.7:1.7@sha256:2a21a074a384a878ba3e0d4681557b90c7121d21a147f500376832b9b7bb656a             359.7s
 => => resolve docker.io/lnlingyuan/lnmp-1.7:1.7@sha256:2a21a074a384a878ba3e0d4681557b90c7121d21a147f500376832b9b7bb656a                            0.0s
 => => sha256:609d1ef5a6a540ced5a5ba89a1b86153c49f437b985a494aec34d13d679080a1 177B / 177B                                                          1.6s
 => => sha256:7a89fe3d1b0d49acc55d7d43d8a54c93921065c40bfc5995d913d916dcfbb5fa 136.78MB / 136.78MB                                                146.0s
 => => sha256:9c0d94ce4d6f40f29c0c6e47031e7f81d4cd730cad11072f3c5564df0f145734 177B / 177B                                                          1.7s
 => => sha256:bdbebe697ba2effecf24fa3f6f765fde093e6c5a012af5b9b64fdd756d6a4e1f 162B / 162B                                                          1.8s
 => => sha256:b181b239b3206299fcfb3a2a58480240883d9f43e38ca0f76da85d71568e45c8 390.37MB / 390.37MB                                                338.5s
 => => sha256:840caab23da4da8d08d9e3ba17d613cdb42ae4dd0679cbb9ff4ff457155701e2 73.36MB / 73.36MB                                                  144.9s
 => => extracting sha256:840caab23da4da8d08d9e3ba17d613cdb42ae4dd0679cbb9ff4ff457155701e2                                                           2.9s
 => => extracting sha256:b181b239b3206299fcfb3a2a58480240883d9f43e38ca0f76da85d71568e45c8                                                          15.5s
 => => extracting sha256:bdbebe697ba2effecf24fa3f6f765fde093e6c5a012af5b9b64fdd756d6a4e1f                                                           0.0s
 => => extracting sha256:9c0d94ce4d6f40f29c0c6e47031e7f81d4cd730cad11072f3c5564df0f145734                                                           0.0s
 => => extracting sha256:7a89fe3d1b0d49acc55d7d43d8a54c93921065c40bfc5995d913d916dcfbb5fa                                                           4.0s
 => => extracting sha256:609d1ef5a6a540ced5a5ba89a1b86153c49f437b985a494aec34d13d679080a1                                                           0.0s
 => CANCELED [linux/amd64 2/4] RUN yum install -y redis &&     curl https://repos.emqx.io/install_emqx.sh | bash                                    2.6s
 => ERROR [linux/arm64 2/4] RUN yum install -y redis &&     curl https://repos.emqx.io/install_emqx.sh | bash                                       2.6s
 => ERROR [linux/arm/v7 2/4] RUN yum install -y redis &&     curl https://repos.emqx.io/install_emqx.sh | bash                                      2.6s
------
 > [linux/arm64 2/4] RUN yum install -y redis &&     curl https://repos.emqx.io/install_emqx.sh | bash:
#15 0.172 .buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture
------
------
 > [linux/arm/v7 2/4] RUN yum install -y redis &&     curl https://repos.emqx.io/install_emqx.sh | bash:
#19 0.175 .buildkit_qemu_emulator: /bin/sh: Invalid ELF image for this architecture
------
Dockerfile:2
--------------------
   1 |     FROM lnlingyuan/lnmp-1.7:1.7
   2 | >>> RUN yum install -y redis && \
   3 | >>>     curl https://repos.emqx.io/install_emqx.sh | bash
   4 |     COPY ./redis.conf /etc/redis.conf
--------------------
error: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c yum install -y redis &&     curl https://repos.emqx.io/install_emqx.sh | bash" did not complete successfully: exit code: 255

报错原因是什么导致的。求大神告知

1840 次点击
所在节点    Docker
1 条回复
boris93
2022-03-10 01:52:21 +08:00
Invalid ELF image for this architecture
说明某个 elf 可执行文件的目标架构跟当前的架构不符

你的基础镜像的系统是啥版本?

我顺着 install_emqx.sh 找到了 repo 地址,给 cent os 6.8 的只有 amd64 平台的包,7 和 8 有 amd64 和 arm64 的,但都没有 arm v7 的

所以我怀疑是 emqx 下载到的可执行文件的平台跟你这俩 arm 平台不匹配

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/839204

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX