title: When installing Rust toolchain in Docker, Bash `source` command doesn't work
body: <p>I am trying to create a docker image that will setup a Linux environment for building Rust projects.  Here is my <code>Dockerfile</code> so far:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The last thing I need to do is configure Rust, so that I can use <code>cargo</code>.  The documentation says to use </p>
  
  <pre><code>source $HOME/.cargo/env
  </code></pre>
  
  <p>but when I try that in a <code>RUN</code> command in a Dockerfile, it says <code>source</code> is not recognized.  Another option I found was to use </p>
  
  <pre><code>RUN /bin/bash -c "source ~/.cargo/env"
  </code></pre>
  
  <p>This does not error, but when I run my container, <code>cargo</code> is not a recognized command.</p>
  
  <p>Either approach works from Bash when I have the container open, but I would like this to be automated as part of the image.</p>
  
  <p>How can I integrate this into my Dockerfile?</p>