rust-lang/docker-rust

Is there no way to get a regular cargo that isn't rustup's cargo??

Opened this issue · 0 comments

It's horribly annoying that rustup's cargo command comes with a ton of side-effect that are neither documented in cargo (cuz it's not cargo, it's actually calling rustup!) nor easy to turn off.

Just getting the docker image of a specific Rust version doesn't give you simply that rust version's cargo release, it gives you a rustup release that will always by default still try to download other toolchain versions if there is a rust-toolchain file present.

This is not the duty of a compiler or package manager. Rustup should be used if people want to access specific versions of the toolchain, but right now it's almost impossible to actually force a single toolchain.

This isn't even about version pinning for security/compatibility reasons, but also just inefficient. We have CI pipelines that install some dependencies and if it just happens that all these dependencies have a different rust-toolchain file, rustup (hidden inside the cargo command!) will just unsollicitedly download and install various toolchains instead of just sticking to the toolchain available and just build (what I would expect when calling cargo build).

I've been dealing with these issues at various occasions and I'm often not even sure what is triggering cargo build to download another random next toolchain. In my own build, f.e. on CI it's also deciding to download a new toolchain somehow and I can't figure out why it does that. I thought that moving to a versioned docker image named rust:1.77.1 would somehow just give me cargo version 1.77.1 and compile stuff with rustc version 1.77.1 and not go off and download whatever toolchain it thinks it should be using instead.

Seriously though. Rustup is nice for people that like to play with many toolchains etc, but I strongly believe it's wrong to ship rustup integrated in the default docker image. Have a docker image named rustup, but an official image named rust:1.77.1 should really ONLY build with version 1.77.1 regardless of rust-toolchain.toml files or environment variables.