title: Docker Ubuntu environment variables
body: <p>During the build stage of my docker images, i would like to set some environment variables automatically for every subsequent "RUN" command.</p>
  
  <p>However, I would like to set these variables from within the docker conatiner, because setting them depends on some internal logic.</p>
  
  <p>Using the dockerfile "ENV" command is not good, because that cannot rely on internal logic. (It cannot rely on a command run inside the docker container)</p>
  
  <p>Normally (if this were not docker) I would set my ~/.profile file. However, docker does not load this file in non-interactive shells.</p>
  
  <p>So at them moment I have to run each docker RUN command with: </p>
  
  <pre><code>RUN bash -c "source ~/.profile &amp;&amp; do_something_here"
  </code></pre>
  
  <p>However, this is very tedious (and unclean) when I have to repeat this every time I want to run a bash command. Is there some other "profile" file I can use instead.</p>