Communication between multiple docker-compose projects
<p>I have two separate <code>docker-compose.yml</code> files in two different folders:</p>

<ul>
<li><code>~/front/docker-compose.yml</code></li>
<li><code>~/api/docker-compose.yml</code></li>
</ul>

<p>How can I make sure that a container in <code>front</code> can send requests to a container in <code>api</code>?</p>

<p>I know that <code>--default-gateway</code> option can be set using <code>docker run</code> for an individual container, so that a specific IP address can be assigned to this container, but it seems that this option is not available when using <code>docker-compose</code>.</p>

<p>Currently I end up doing a <code>docker inspect my_api_container_id</code> and look at the gateway in the output. It works but the problem is that this IP is randomly attributed, so I can't rely on it.</p>

<p>Another form of this question might thus be:</p>

<ul>
<li>Can I attribute a fixed IP address to a particular container using docker-compose?</li>
</ul>

<p>But in the end what I'm looking after is:</p>

<ul>
<li>How can two different docker-compose projects communicate with each other?</li>
</ul>