Sign inSign up

schickling/rust

By schickling

Updated over 7 years ago

Lightweight nightly Rust build including Cargo and GDB

Image
26

4.3K

schickling/rust repository overview

rust

Lightweight nightly Rust build including Cargo and GDB

Usage

$ docker run --rm -it -v $(pwd):/source schickling/rust

Mount your local source folder to the container and compile & run code inside.

Compiling code
$ rustc hello-world.rs
$ ./hello-world
> Hello World!
Environment variables

The $USER environment variable can be specified, which is used by cargo. The default is root.

$ docker run --rm -it -e USER="John Doe" -v $(pwd):/source schickling/rust
Running cargo as local user

In order to run cargo as a local user and not as root run this:

$ docker run --rm -it \
  -u $UID \
  -e USER=$USER \
  -e CARGO_HOME=/source/.cargo \
  -v $HOME/.cargo:/source/.cargo \
  -v $(pwd):/source \
  schickling/rust \
  cargo build

Note the new volume for the cargo cache and the -u flag.

Tag summary

Content type

Image

Digest

sha256:5673901cc

Size

329.9 MB

Last updated

over 7 years ago

docker pull schickling/rust