title: envsubst command getting stuck in a container
body: <p>I have a requirement that before an application runs, some part of it needs to read the environmental variable. For this I have the following docker file </p>
  
  <pre><code>FROM nodesource/jessie:0.12.7
  
  # install gettext for envsubst
  RUN apt-get update
  RUN apt-get install -y gettext-base
  
  # cache package.json and node_modules to speed up builds
  ADD package.json package.json
  RUN npm install
  
  # Add  source files
  ADD src src
  
  # Substiture value for backend endpoint env var
  RUN envsubst &lt; src/js/envapp.js &gt; src/js/app.js
  
  ADD node_modules node_modules
  EXPOSE 8000
  CMD ["npm","start"]
  </code></pre>
  
  <p>The above envsubst line reads (should read) an env variable <code>$MYENV</code> and substitutes it. But when I open the file app.js, its empty.
  I checked if the environmental variable exists in the container and it does. Any reason its value is not read and substituted?
  I also tried the same command in teh container and it works. It only does not work when I run the image</p>