title: How to pass through environment variables in docker run through an env file?
body: <p>Given this Dockerfile:</p>
  
  <pre><code>FROM alpine:3.7
  ENV LAST_UPDATED=2018-02-22
  ARG XDG_CACHE_HOME=/tmp/cache/
  RUN apk update &amp;&amp; \
      apk add libxslt &amp;&amp; \
      apk add sed &amp;&amp; \
      apk add py-pip &amp;&amp; \
      apk add mariadb-client &amp;&amp; \
      apk add bash bash-doc bash-completion &amp;&amp; \
      pip install httpie &amp;&amp; \
      rm -rf /var/cache/apk/*
  WORKDIR /usr/deleter/
  COPY delete.sh ./
  ENTRYPOINT ["/usr/deleter/delete.sh"]
  </code></pre>
  
  <p>I expected to be able to pass multiple variables through an <code>.env</code> file with the <code>key=value</code> format.</p>
  
  <pre><code>$ cat stage.env 
  MYSQL_DATABASE=database
  MYSQL_HOST=127.0.0.1:3306
  MYSQL_PASSWORD=password
  MYSQL_PORT=3306
  MYSQL_USER=a_user
  </code></pre>
  
  <p>My <code>delete.sh</code> only looks like this:</p>
  
  <pre><code>#!/bin/bash
  set -e
  set -o pipefail
  echo "hello world"
  echo ${MYSQL_DATABASE} ${MYSQL_HOST} ${MYSQL_PASSWORD} ${MYSQL_PORT} ${MYSQL_USER}
  echo "ALL VARIABLES"
  env
  </code></pre>
  
  <p>I expected to see the env variables, yet they all are empty. The <code>--env-file</code> options seems to be not working. The output of the script is:</p>
  
  <pre><code>hello world
  
  ALL VARIABLES
  HOSTNAME=f52c5c2aa22b
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  PWD=/usr/deleter
  LAST_UPDATED=2018-02-22
  SHLVL=1
  HOME=/root
  _=/usr/bin/env
  </code></pre>
  
  <p>I create and run the docker container via:</p>
  
  <pre><code>docker build -t deleter:local
  docker run deleter:local --env-file stage.env
  </code></pre>
  
  <p>I tried <code>--env-file stage.env</code>, <code>--env-file=stage.env</code>, <code>--env-file ./stage.env</code>, yet I don't see anything being included nor any thrown error. I also tried it with the absolute path.</p>
  
  <p>The <code>stage.env</code> is on the same level as my Dockerfile.</p>
  
  <p>The env file is valid, I can source it on my local machine an access the variables there.</p>
  
  <p>Where is my mistake?</p>