我正在尝试交叉编译一个 rust 应用程序以在我的树莓派集群上运行。我看到来自 docker 的 buildx 应该能够使这成为可能。我现在有一个最小的 dockerfile,如下所示:
FROM rust
RUN apt-get update
ENTRYPOINT ["echo", "hello world"]
我尝试通过运行以下命令来编译它:docker buildx build --platform=linux/arm/v7 some/repo:tag .
当我这样做时,我收到以下错误:
[+] Building 0.9s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 102B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/rust:latest 0.7s => CACHED [1/2] FROM docker.io/library/rust@sha256:65e254fff15478af71d342706b1e73b26fd883f3432813c129665a97a74e2278
0.0s => ERROR [2/2] RUN apt-get update 0.2s
------
> [2/2] RUN apt-get update:
#5 0.191 standard_init_linux.go:219: exec user process caused: exec format error
------ error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c apt-get update]: exit code: 1
我觉得我在这里遗漏了一些非常基本的东西,希望有人告诉我为什么这么简单的东西对我不起作用。
我在 Ubuntu 操作系统上运行 docker 版本 20.10.1
提前致谢!
输出docker buildx inspect --bootstrap
:
Name: default
Driver: docker
Nodes:
Name: default
Endpoint: default
Status: running
Platforms: linux/amd64, linux/386
输出ls -l /proc/sys/fs/binfmt_misc/
:
total 0
--w------- 1 root root 0 Dec 19 07:29 register
-rw-r--r-- 1 root root 0 Dec 19 07:29 status