rust-lang / rust-lang/docker-rust

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

Open
#212 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dockerfile
Stars
537
Forks
111
Avg merge
1d 38m
Merged PRs (30d)
4

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review how the rust:1.77.1 Docker image is assembled and how rustup affects cargo build when rust-toolchain.toml files or environment variables are present. Reproduce the unsolicited toolchain downloads in the image, then determine whether the requested fixed-toolchain behavior can be provided by the official image or a separate image.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, rust
Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.