title: docker run script which exports env variables
body: <p>I've search some of the questions already like <a href="https://stackoverflow.com/questions/33379393/docker-env-vs-run-export">docker ENV vs RUN export</a>, which explains differences between those commands, but didn't help in solving my problem.</p>
  
  <p>For example I have a script called <code>myscript</code>:</p>
  
  <pre><code>#!/bin/bash
  export PLATFORM_HOME="$(pwd)"
  </code></pre>
  
  <p>And have following lines in Dockerfile:</p>
  
  <pre><code>...
  COPY myscript.sh /
  RUN ./myscript.sh
  </code></pre>
  
  <p>I've also tried to use ENTRYPOINT instead of RUN or declaring variable before calling the script, all that with no success.</p>
  
  <p>What I want to achieve is that <code>PLATFORM_HOME</code> can be referenced from other Dockerfiles which use that one as a base. How to do it ?</p>