in Programming

Rust with Docker and Visual Studio Code

1. Install Rustup

Install rustup – installer for the systems programming language Rust.

If you don’t want to install rustup using script obtained using curl, you can use my Docker image which contains installed rustup:

$ docker image pull h00s/rustup

Create directory where Rust toolchain will be located:

$ mkdir $HOME/.rustup

2. Install Rust toolchain

Using rustup Docker image, install toolchain (on GNU Linux):

$ docker container run --rm --user "$(id -u)":"$(id -g)" -v $HOME/.rustup:/.rustup h00s/rustup /usr/bin/rustup install stable-x86_64-unknown-linux-gnu

Add $HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin to PATH.

3. Install components

$ docker container run --rm --user "$(id -u)":"$(id -g)" -v $HOME/.rustup:/.rustup h00s/rustup /usr/bin/rustup component add rls

$ docker container run --rm --user "$(id -u)":"$(id -g)" -v $HOME/.rustup:/.rustup h00s/rustup /usr/bin/rustup component add rust-src

$ docker container run --rm --user "$(id -u)":"$(id -g)" -v $HOME/.rustup:/.rustup h00s/rustup /usr/bin/rustup component add rust-analysis

4. Configure VSCode for Rust

Install Rust Extension to VSCode. Make sure you added toolchain bin directory to PATH.

Add this to VSCode settings.json:

"rust-client.trace.server": "messages",
"rust-client.disableRustup": true,

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Related Content by Tag