Posted at

rust in docker で cargo build に失敗するときの対処法

More than 1 year has passed since last update.

こんな感じのエラーが出る

root@59a819b944e6:/source# cargo build --verbose

Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to load source for a dependency on `rand`

Caused by:
Unable to update registry https://github.com/rust-lang/crates.io-index

Caused by:
failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
[16/-17] The SSL certificate is invalid

そんなときは

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

を設定すると解決します