title: Assign value of environment variable to another variable in .env file
body: <p>I define a variable in an <code>.env</code> file:</p>
  
  <pre><code>LOCAL_IP=127.0.0.1
  </code></pre>
  
  <p>When using this in the following <code>docker-compose.yml</code> I can see that the variable is expanded to <code>127.0.0.1</code> by running <code>docker-compose config</code>.</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>services:
    my-service:
      environment:
        # This gets expanded to http://127.0.0.1/services
        SERVICE_ENDPOINT: http://${LOCAL_IP}/services
  </code></pre>
  
  <p>Now I'd like to reference the value of <code>LOCAL_IP</code> in another variable in the same file like:</p>
  
  <pre><code>LOCAL_IP=127.0.0.1
  SOME_OTHER_VAR=$LOCAL_IP
  </code></pre>
  
  <p><strong>Updated docker-compose.yml</strong></p>
  
  <pre><code>services:
    my-service:
      environment:
        SERVICE_ENDPOINT: http://${SOME_OTHER_VAR}/services
  </code></pre>
  
  <p>Running <code>docker-compose config</code> then gives me:</p>
  
  <pre><code>services:
    my-service:
      environment:
        # I'd have expected http://127.0.0.1/services
        SERVICE_ENDPOINT: http://$$LOCAL_IP:8090/services
  </code></pre>