rust-lang / docker-rust

The official Docker images for Rust
428 stars 89 forks source link

Docker Hub rust:alpine image fails to read crates.io with various "spurious network errors" #184

Closed ScarletCarson closed 3 months ago

ScarletCarson commented 3 months ago

Image: sha256:ba706e9ee0c6ba7fd828131b4302ed46446d9313fc3c1d82897350b94c6b1084

What: A build, running happily, suddenly began failing with "spurious network errors" When: 4-5 days ago Expected Behavior: cargo build --bins --release should succeed without network errors Actual Behavior: cargo build --bins --release tries to update index.crates.io and fails with "spurious network error"

Other factors: In that failing build I've added a line to show name resolution is working then cargo build fails with name resolution error.:

rustbuilder 5/7 RUN getent hosts index.crates.io responds correctly. rustbuilder 7/7 RUN cargo build --bins --release fails suggesting name resolution failure (or any one of numerous other spurious errors)

Reverting rustbuilder to rust:1.75.0-alpine3.19 resolves the issue and the build succeeds.

Redacted error log:

#14 [rustbuilder 5/7] RUN getent hosts index.crates.io
#14 5.391 18.154.219.96     d16zogpfyuwazr.cloudfront.net  d16zogpfyuwazr.cloudfront.net index.crates.io
#14 DONE 5.5s
#15 [rustbuilder 6/7] RUN mkdir -p /usr/src/xxx/.cargo;     echo -en "[registry]\nglobal-credential-providers = ["cargo:token"]\n[registries]\nreg = { index = "sparse+https://reg.redacted.zzz/api/packages/reg/cargo/" }\n" > /usr/src/xxx/.cargo/config.toml;
#15 DONE 0.1s
#16 [rustbuilder 7/7] RUN cargo build --bins --release
#16 0.235     Updating `reg` index
#16 0.258     Updating crates.io index
#16 5.260 warning: spurious network error (3 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
#16 11.43 warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
#16 19.93 warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
#16 31.47 error: failed to get `chrono` as a dependency of package `xxx v0.1.0 (/usr/src/xxx)`
#16 31.47 
#16 31.47 Caused by:
#16 31.47   failed to query replaced source registry `crates-io`
#16 31.47 
#16 31.47 Caused by:
#16 31.47   download of config.json failed
#16 31.47 
#16 31.47 Caused by:
#16 31.47   failed to download from `https://index.crates.io/config.json`
#16 31.47 
#16 31.47 Caused by:
#16 31.47   [6] Couldn't resolve host name (Could not resolve host: index.crates.io)
#16 ERROR: process "/bin/sh -c cargo build --bins --release" did not complete successfully: exit code: 101
ScarletCarson commented 3 months ago

Issue has returned on rust:1.75.0-alpine3.19.

ScarletCarson commented 3 months ago

This probably isn't a docker-rust issue.