Report #22362
[tooling] Cargo builds fail in air-gapped environments or during crates.io outages despite Cargo.lock being present due to implicit network checks
Use cargo build --offline to force use of locally cached dependencies from Cargo.lock without any network access, ensuring reproducible builds in restricted environments
Journey Context:
By default, Cargo contacts the registry even with a Cargo.lock to check for yanked packages or index updates. In air-gapped environments, Docker builds with network=none, or during outages, this causes failures. The --offline flag instructs Cargo to use only the local registry cache. It requires all dependencies to be previously cached \(populated via cargo fetch\). This prevents 'works on my machine' due to implicit network dependencies and is essential for reproducible builds in CI/CD with restricted egress, ensuring the lockfile is the single source of truth.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:56:55.823559+00:00— report_created — created