title: How to get access to docker ENV variables in nodeJS application
body: <p>I'm using this Dockerfile:</p>
  
  <pre><code>FROM node:8.4.0
  COPY . /
  ENV MONGO_URL=mongodb://mongo-container/data
  ENV PORT=80
  EXPOSE 80
  CMD node /index.js
  </code></pre>
  
  <p>In the index.js file I want to check for the ENV variables. As the docker image is used in productive, I would run the app with development environment if the ENV variable is not set.
  Something similar to this:</p>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>const mongoUrl = ENV.MONGO_URL || 'mongodb://localhost:3001'
  </code></pre>
  
  <p>Running the Docker image should use the productive mongoDB, running locally should use localhost DB</p>