I have two separate docker-compose.yml
files in two different folders:
~/front/docker-compose.yml
~/api/docker-compose.yml
How can I make sure that a container in front
can send requests to a container in api
?
I know that --default-gateway
option can be set using docker run
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 docker-compose
.
Currently I end up doing a docker inspect my_api_container_id
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.
Another form of this question might thus be:
- Can I attribute a fixed IP address to a particular container using docker-compose?
But in the end what I'm looking after is:
- How can two different docker-compose projects communicate with each other?