title: How to get the environment variable from .env file on to a docker-compose.yml?
body: <p>I have an <code>.env</code> file and a docker-compose file. I reference the env file using the <code>env_file</code> property on the docker-compose. Then I use the variable interpolation to set another environment variable using the variable defined in the .env file. For some reason, Docker doesn't recognize the variable defined in the .env file.</p>
  
  <p><strong>app.env</strong>:</p>
  
  <pre><code>MYSQL_DATABASE=wordpress
  DB_USER=root
  MYSQL_ROOT_PASSWORD=example
  </code></pre>
  
  <p><strong>docker-compose.yml</strong>:</p>
  
  <pre><code>version: '3.1'
  services:
    wordpress:
      container_name: 'wp'
      build: .
      restart: unless-stopped
      links:
        - mysql
      env_file:
        - app.env
      environment:
        - WORDPRESS_DB_USER=${DB_USER}
        - WORDPRESS_DB_PASSWORD=${MYSQL_ROOT_PASSWORD}
        - WORDPRESS_DB_NAME=${MYSQL_DATABASE}
      ports:
        - 80:80
  </code></pre>