V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
DaChuiZi
V2EX  ›  Docker

Docker buildx 报错了,求大神看看

  •  
  •   DaChuiZi · 2022-03-09 18:20:56 +08:00 · 1838 次点击
    这是一个创建于 992 天前的主题,其中的信息可能已经有所发展或是发生改变。
    问题遇到的现象和发生背景

    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
    
    

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

    boris93
        1
    boris93  
       2022-03-10 01:52:21 +08:00 via iPhone
    Invalid ELF image for this architecture
    说明某个 elf 可执行文件的目标架构跟当前的架构不符

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

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

    所以我怀疑是 emqx 下载到的可执行文件的平台跟你这俩 arm 平台不匹配
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3193 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 13:40 · PVG 21:40 · LAX 05:40 · JFK 08:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.