When installing Rust toolchain in Docker, Bash `source` command doesn't work

Asked
Active3 hr before
Viewed126 times

6 Answers

doesninstalling
90%

Also, note that there are rust images on DockerHub, you can use them (in FROM, instead of ubuntu:16.04) for running or building Rust apps. It will be faster and easier than installing everything via apt and curl.,I am trying to create a docker image that will setup a Linux environment for building Rust projects. Here is my Dockerfile so far:,If you want the variables to be applied to a shell inside the container, you need to add the source command to one of the bash files that is sourced when the shell is started, e.g. ~/.bashrc or ~/.bash_profile (depending on whether a login shell is started or not) or (on most distributions) a .sh file in /etc/profile.d/, Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers

This works:

FROM ubuntu: 16.04

# Update
default packages
RUN apt - get update

# Get Ubuntu packages
RUN apt - get install - y\
build - essential\
curl

# Update new packages
RUN apt - get update

# Get Rust
RUN curl https: //sh.rustup.rs -sSf | bash -s -- -y

   RUN echo 'source $HOME/.cargo/env' >> $HOME / .bashrc
load more v
88%

After installing rustup using the following:,To configure your current shell run source $HOME/.cargo/env,curl https://sh.rustup.rs -sSf | sh info: downloading installer,Ubuntu based systems @simanacci solution works fine. Installer points this after installation #To configure your current shell run source $HOME/.cargo/env

rdotdk@rdotdk-laptop ~ $ curl -sf https://static.rust-lang.org/rustup.sh | sudo sh
rustup: gpg available. signatures will be verified
rustup: downloading manifest for 'stable'
rustup: downloading toolchain for 'stable'
######################################################################## 100.0%
gpg: assuming signed data in '/home/rdotdk/.rustup/dl/f7decfef7346bba449da/rust-1.11.0-i686-unknown-linux-gnu.tar.gz'
gpg: Signature made Tuesday 16 August 2016 05:05:09 PM IST using RSA key ID 7B3B09DC
gpg: Good signature from "Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>" [unknown]
   gpg: WARNING: This key is not certified with a trusted signature!
   gpg: There is no indication that the signature belongs to the owner.
   Primary key fingerprint: 108F 6620 5EAE B0AA A8DD 5E1C 85AB 96E6 FA1B E5FE
   Subkey fingerprint: C134 66B7 E169 A085 1886 3216 5CB4 A934 7B3B 09DC
   rustup: installing toolchain for 'stable'
   rustup: extracting installer
   install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
   install: installing component 'rustc'
   install: installing component 'rust-std-i686-unknown-linux-gnu'
   install: installing component 'rust-docs'
   install: installing component 'cargo'

   Rust is ready to roll.

   rdotdk@rdotdk-laptop ~ $ rustc -V
   rustc 1.11.0 (9b21dcd6a 2016-08-15)
   rdotdk@rdotdk-laptop ~ $ cargo -V
   cargo 0.12.0-nightly (6b98d1f 2016-07-04)
   rdotdk@rdotdk-laptop ~ $ rustup
   rustup: command not found

   rdotdk@rdotdk-laptop ~ $ uname -a
   Linux rdotdk-laptop 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:34:49 UTC 2016 i686 i686 i686 GNU/Linux
   rdotdk@rdotdk-laptop ~ $ lsb_release -a
   No LSB modules are available.
   Distributor ID: LinuxMint
   Description: Linux Mint 18 Sarah
   Release: 18
   Codename: sarah
   rdotdk@rdotdk-laptop ~ $
load more v
72%

curl--proto '=https'--tlsv1 .2 - sSf https: //sh.rustup.rs | sh
65%

Building cryptography on Windows,Building cryptography on macOS,Building cryptography requires having a working Rust toolchain. The current minimum supported Rust version is 1.41.0. This is newer than the Rust most package managers ship, so users will likely need to install with the instructions below.,If you need to rebuild cryptography for any reason be sure to clear the local wheel cache.

$ pip install cryptography
load more v
75%

In this example, when the shell task is invoked, the script content will be automatically converted to windows batch commands (in case we are on windows platform) and invoked.,In this example, when the rust task is invoked, the script content will be compiled and executed. You can see how dependencies are defined in Cargo.toml format inside the code.,@shell - For windows platform, it will try to convert the shell commands to windows batch commands (only basic scripts are supported) and execute the script, for other platforms the script will be executed as is. See example,Tasks which only install some dependency but do not invoke any command start with the install- prefix, for example:

cargo install--force cargo - make
load more v
40%

configure, build and install the cross-compilation toolchain, or simply import an external toolchain; ,The make command will generally perform the following steps:,The main Makefile performs the following steps (once the configuration is done):, The toolchain/ directory contains the Makefiles and associated files for all software related to the cross-compilation toolchain: binutils, gcc, gdb, kernel-headers and uClibc.

If you want to setup an isolated buildroot environment on Linux or Mac Os X, paste this line onto your terminal:

curl - O https: //buildroot.org/downloads/Vagrantfile; vagrant up

If you are on Windows, paste this into your powershell:

(new - object System.Net.WebClient).DownloadFile(
   "https://buildroot.org/downloads/Vagrantfile", "Vagrantfile");
vagrant up
load more v

Other "doesn-installing" queries related to "When installing Rust toolchain in Docker, Bash `source` command doesn't work"