Two Docker-Composers, one in php and one in elastic, how do they connect?

  docker, question

1. Because php environment was built very early, now the business needs to use elasticsearch.
2. Now a docker-composer is newly defined to build elk environment.
3. The container gateways created by the two are different.

php7
“Gateway”: “172.18.0.1”,
“IPAddress”: “172.18.0.6”,

elasticsearch
“Gateway”: “172.19.0.1”,
“IPAddress”: “172.19.0.2”,

Question: How can the php environment now connect to the elasticsearch service?

Just add it to the same network. There is a description of network in compose. You can look at it.