dockerfile-cargo-install-without-locked
Detects Rust Dockerfiles that install external Rust tools with cargo install without --locked.
This rule looks for:
- a Docker build discovered from GitHub Actions
Cargo.tomlin the build contextRUN cargo install ...- no
--lockedflag - no
--pathflag
Why it matters:
- Docker builds should install reproducible tool versions.
cargo install --lockeduses the installed crate’s lockfile when available.- Without
--locked, tools such ascargo-cheforsccachecan resolve a different dependency graph during image construction.
What to do:
- Add
--lockedto external tool installs, for examplecargo install cargo-chef sccache --locked. - Keep local project installs such as
cargo install --path .separate; this rule does not flag those.
This rule is focused on Docker build reproducibility for external Rust tooling.