docker - 编译 azure iot edge 的 edgelet 模块时出现 cargo 错误

标签 docker rust rust-cargo azure-iot-edge

我正尝试在 docker 中cargo build Azure IoT 边缘安全守护程序代码 (edgelet)。这在我的 Ubuntu 机器上很顺利。但是,当我尝试在 Docker 中编译时出现问题。

问题是:

 Compiling k8s-openapi v0.4.0
 error: inclusive range syntax is experimental (see issue #28237)
 --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/k8s-openapi-0.4.0/build.rs:10:19
 |
 10 |         for v2 in MIN..=MAX {
 |                   ^^^^^^^^^

 error: inclusive range syntax is experimental (see issue #28237)
 --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/k8s-openapi-0.4.0/build.rs:32:14
 |
 32 |     for v in MIN..=MAX {
 |              ^^^^^^^^^

 error: inclusive range syntax is experimental (see issue #28237)
 --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/k8s- 
 openapi-0.4.0/build.rs:117:14
|
117 |     for v in MIN..=MAX {
|              ^^^^^^^^^

error: aborting due to 3 previous errors

error: Could not compile `k8s-openapi`.

这是我的 Docker 文件的一部分:

RUN apt-get update  && \
apt-get install -y --no-install-recommends --allow-unauthenticated\
 curl\
 cargo
WORKDIR /usr/app
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
COPY edgelet .
RUN cargo build

最佳答案

请检查您的 docker 镜像中使用的 rustc 版本和您 Ubuntu 机器上的编译器版本。

该行为的唯一可能原因是您的 docker 镜像中有旧版本的 rustc。

关于docker - 编译 azure iot edge 的 edgelet 模块时出现 cargo 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57253853/

相关文章:

rust - rsmpi 'mpi = 0.5.4'由于显然是拼写错误的函数调用而无法编译

import - 如何在另一个 bin 中重用主 bin 中的代码?

linux - "Is your docker daemon up and running?"Linux 上 docker hello world 教程的问题

docker - 有没有更好的方法将文件和文件夹复制到 docker 容器?

rust - 从 Rust 中的多个目录导入代码

string - 将i8的向量转换为Rust中u8的向量? [复制]

Rust actix-web : the trait `Handler<_, _>` is not implemented

linux - Docker大使的局限性?其他 Docker 机器上的 Syslog 很快就满了

docker - 启动 wolkenkit 失败

rust - 类型 `Vec<&str>` 的值不能从 `std::iter::Iterator<Item=&&str>` 构建