title: Multiple Docker build args from docker-compose .env file
body: <p>I am experiencing an odd issue with docker-compose's <code>.env</code> file. I am able to use the first variable key=pair in my .env file, but only the first variable. This is my folder structure</p>
  
  <pre><code>|- root
  |  |- .env
  |  |- docker-compose.yaml
  |  |- service-1
  |     |- Dockerfile
  </code></pre>
  
  <p>.env:</p>
  
  <pre><code>GIT_TOKEN=c3e13c4e33935
  DB_PWD=mypassword
  </code></pre>
  
  <p>docker-compose.yaml:</p>
  
  <pre><code>version: '3'
  web-server:
        container_name: service-1
        image: sdc/service-1:0.1
        build:
          context: ./service-1
          args:
            - GIT_TOKEN=$GIT_TOKEN
            - DB_PWD=$DB_PWD
  </code></pre>
  
  <p>service-1/Dockerfile:</p>
  
  <pre><code>FROM node:boron
  ARG GIT_TOKEN
  ARG DB_PWD
  RUN git clone https://${GIT_TOKEN}@github.com/chrxn/sdc.git
  RUN echo {"database_password:" $DB_PWD } &gt; crews.txt
  </code></pre>
  
  <p>The problem is that the GIT_TOKEN variable is working perfectly, but the DB_PWD variable is not. Even if put the GIT_TOKEN variable in the echo line, the token is saved to a file (so I know it isn't an echo/bash interpolation issue) Any help is greatly appreciated. I have read everything I can find related to Docker's environment variables.</p>
  
  <p>NOTE: I've modified a few things. My database password is not mypassword and that isn't a real git repo</p>
  
  <p>References: </p>
  
  <ul>
  <li><a href="https://docs.docker.com/compose/env-file/" rel="noreferrer">.env file</a> </li>
  <li><a href="https://docs.docker.com/compose/compose-file/#args" rel="noreferrer">ARG</a></li>
  <li><a href="https://staxmanade.com/2016/05/how-to-get-environment-variables-passed-through-docker-compose-to-the-containers/" rel="noreferrer">Similar example but setting container environment variables</a></li>
  <li><a href="https://github.com/docker/compose/issues/4223" rel="noreferrer">False issue raised because .env and env_file is so confusing</a></li>
  <li><a href="https://stackoverflow.com/questions/41916386/arg-or-env-which-one-to-use-in-this-case#answer-41919137">combine ARG and ENV</a></li>
  </ul>
  
  <p>I really would like to stick to Docker build arguments instead of environmental variables so that the values are not stored in the container's environment variables.</p>