<p>The <code>docker-compose</code> will automatically read the <code>.env</code> file if it resides in a same with the <code>docker-compose.yml</code> directory. With this in mind, I go ahead and in <code>.env</code> file define the <code>app-container</code> environment variable to store the container URL, like so:</p>

<pre><code>app-container=12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003
</code></pre>

<p>In a <code>docker-compose.yml</code> file I then substitute the container URL with the environment variable <code>app-container</code>.</p>

<pre><code>    version: '3'

    services:
      app1:
        build:
          context: .
          dockerfile: my.dockerfile
          image: ${app-container}
</code></pre>

<p>It would be great if I could pass the same <code>app-container</code> environment variable to substitute the container's URL defined in Helm's <code>values.yaml</code> file. So, instead of storing the container's URL explicitly</p>

<pre><code>app:
  image: 12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003
</code></pre>

<p>the Helm's <code>values.yaml</code> file could use the same <code>app-container</code> environment variable that was already defined in <code>.env</code> file and used by <code>docker-compose</code>. The Helm's <code>values.yaml</code> file could be then simply defined as:</p>

<pre><code>app:
  image: ${app-container}
</code></pre>

<p>I wonder if sharing the same <code>env</code> file between <code>docker-compose</code> and Helm is possible?</p>

alphanumeric
<p>Try this, its little hacky way:</p>

<ul>
<li>First set the environment variable from <code>.env</code> file.</li>
</ul>

<pre><code>$ cat .env
appcontainer=12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003
$ while read LINE; do export "$LINE"; done &lt; .env
</code></pre>

<p><strong><em>NOTE:</strong> You need to remove <code>-</code> from <code>app-container</code> name. Otherwise you will get this error while setting environment variable <code>bash: export: app-container=12345.dkr.ecr.us-west-2.amazonaws.com/container-image:v003': not a valid identifier</code></em></p>

<ul>
<li>Now explicitly set that env in values.yaml using <code>--set</code> option.</li>
</ul>

<pre><code>helm install --set app.image=$appcontainer ./mychart
</code></pre>

<p>But ideally it would be good to have separate env for your <code>docker-compose</code> and <code>helm chart</code>.</p>

<p>Hope this helps.</p>
