Get or set env variable in docker-compose.yml file
<p>I have got a <code>docker-compose.yml</code> file and there I define:</p>

<pre><code>extra_hosts:
- "localhost:${MY_MACHINE_IP}"
</code></pre>

<p>It works if I define MY_MACHINE_IP as environment var earlier.</p>

<p>What I want to achieve is to perform action like:</p>

<pre><code>extra_hosts:
- "localhost:&lt;get MY_MACHINE_IP from env if it exists, if not set MY_MACHINE_IP env variable with value &lt;docker-machine-ip&gt;&gt;"
</code></pre>

<p>In other words: I want to define it in extra_hosts section, if MY_MACHINE_IP is already specified, get it, if not - set this env. variable with value = my docker machine ip.</p>

<p>Is it possible?</p>