我正试图在Centos7 x86_64上构建一个Dockerfile。码头映像应该运行在arm64 linux机器上。为了准备我的机器进行交叉编译,我检查了:
>docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS
default * docker
default default running linux/amd64, linux/386我正在尝试将linux/arm64添加到平台列表中,但是没有任何效果。
我从arm https://github.com/docker/buildx/releases下载到/usr/libexec/docker/cli/docker
其结果是,我可以运行“码头建设ls”。所以我尊敬它。
/usr/libexec/docker/cli-plugins/docker-buildx
我叫
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:
FROM ubuntu
ARG TARGETARCH=arm64
ARG CPUARCH=aarch64
RUN mkdir -p config/cmap我使用以下命令运行了构建命令:/arm64。
这个消息失败了:
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构建的交叉编译是行不通的。
发布于 2022-09-21 22:31:35
内核版本应该更新到4.8以上。带有内核3.10的Centos 7不支持对坞映像进行交叉编译
https://stackoverflow.com/questions/73778867
复制相似问题