首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >buildx中的docker交叉编译缺失平台

buildx中的docker交叉编译缺失平台
EN

Stack Overflow用户
提问于 2022-09-19 20:21:48
回答 1查看 254关注 0票数 -1

我正试图在Centos7 x86_64上构建一个Dockerfile。码头映像应该运行在arm64 linux机器上。为了准备我的机器进行交叉编译,我检查了:

代码语言:javascript
复制
>docker buildx ls

NAME/NODE DRIVER/ENDPOINT STATUS  PLATFORMS
default * docker
  default default         running linux/amd64, linux/386

我正在尝试将linux/arm64添加到平台列表中,但是没有任何效果。

  1. i紧随其后:https://docs.docker.com/build/buildx/install/

我从arm https://github.com/docker/buildx/releases下载到/usr/libexec/docker/cli/docker

其结果是,我可以运行“码头建设ls”。所以我尊敬它。

  1. i将码头设置为实验真

  1. i工作于对接版20.10.18

/usr/libexec/docker/cli-plugins/docker-buildx

  1. i给了完全许可

我叫

docker run --privileged --rm tonistiigi/binfmt --install all

结果是:

installing: arm64 cannot register "/usr/bin/qemu-aarch64" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument installing: arm cannot register "/usr/bin/qemu-arm" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument installing: riscv64 cannot register "/usr/bin/qemu-riscv64" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument installing: mips64le cannot register "/usr/bin/qemu-mips64el" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument installing: mips64 cannot register "/usr/bin/qemu-mips64" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument installing: s390x cannot register "/usr/bin/qemu-s390x" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument installing: ppc64le cannot register "/usr/bin/qemu-ppc64le" to /proc/sys/fs/binfmt_misc/register: write /proc/sys/fs/binfmt_misc/register: invalid argument { "supported": [ "linux/amd64", "linux/386" ], "emulators": [ "jexec", "kshcomp" ] }

在这之后,似乎有了Desktop,缺少的平台就出现了。

我可以添加没有码头桌面的arm64吗?

顺便说一句,我试着像这样构建Dockerfile:

代码语言:javascript
复制
FROM ubuntu
ARG TARGETARCH=arm64
ARG CPUARCH=aarch64
RUN mkdir -p config/cmap

我使用以下命令运行了构建命令:/arm64。

这个消息失败了:

代码语言:javascript
复制
Sending build context to Docker daemon  2.048kB
Step 1/4 : FROM ubuntu
latest: Pulling from library/ubuntu
00f50047d606: Already exists
Digest: sha256:20fa2d7bb4de7723f542be5923b06c4d704370f0390e4ae9e1c833c8785644c1
Status: Downloaded newer image for ubuntu:latest
 ---> 21735dab04ba
Step 2/4 : ARG TARGETARCH=arm64
 ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
 ---> Running in 7de7701f6b3a
Removing intermediate container 7de7701f6b3a
 ---> b4438f9c8791
Step 3/4 : ARG CPUARCH=aarch64
 ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
 ---> Running in b3aa3d8c24f7
Removing intermediate container b3aa3d8c24f7
 ---> 5be105ca2646
Step 4/4 : RUN mkdir -p config/cmap
 ---> [Warning] The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
 ---> Running in 4be5019859f8
standard_init_linux.go:228: exec user process caused: exec format error
The command '/bin/sh -c mkdir -p config/cmap' returned a non-zero code: 1

看来,除非有一种方法在buildx平台上设置linux/arm64,否则对docker构建的交叉编译是行不通的。

EN

回答 1

Stack Overflow用户

发布于 2022-09-21 22:31:35

内核版本应该更新到4.8以上。带有内核3.10的Centos 7不支持对坞映像进行交叉编译

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73778867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档