从 Cargo.io 注册表获取 Dockerized Cargo 依赖项失败

问题描述 投票:0回答:0

我正在构建一个使用

cargo build
编译的 Yocto 层,它在 dockerized Ubuntu (22.04) 图像上运行,配方有一个 Cargo.toml 文件,其中包含其他依赖项:

[dependencies]
base64 = "0.21"
url = "2.3"
reqwest = "0.11"
jwt = "0.16.0"

这导致

| error: no matching package named `base64` found
| location searched: registry `crates-io`

我可以指定 git-repository 并且它有效,当 base64 在 base64 的 Cargo.toml 文件中有另一个依赖项时,问题就来了,它将默认为注册表

crates-io
,这反过来返回与上面相同的错误。

| error: no matching package named `base64` found
| location searched: registry `crates-io`
| required by package `jwt v0.16.0 (https://github.com/glimberg/rust-jwt#61a9291f)`

因为在指定 git-repository 时它可以获取依赖项,我知道网络没有任何问题,感觉就像我缺少货物在 dockerized Ubuntu 图像上正确运行的一些依赖项。
尝试查看 Cargo 并试图找到它的依赖项或它如何搜索 cargo.io 上的依赖项,据我所知,它使用

git
sparse
与注册表进行通信。
git
是默认值,我尝试将其更改为
sparse
documentation 并将稀疏添加到 docker 图像,但输出仍然相同。

这里有人知道我可能遗漏了什么吗?

docker ubuntu registry cargo
© www.soinside.com 2019 - 2024. All rights reserved.