I use laradock.
I created multiple projects. One project is one microservice.
I need to use guzzle http to get data from one microservice to another.
In laradock/nginx/sites I configured all virtual host.
Each project(microservice) work fine separatly.
But when I try get data from one container for another:
$url = "test.localhost/users";
$client = new \GuzzleHttp\Client();
$request = $client->get($url);
$response = $request->getBody();
return json_decode($response->getContents(), true);
I got an error:
GuzzleHttp \ Exception \ ConnectException cURL error 7: Failed to connect to test.localhost port 80: Connection timed out (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
I think this is problem with docker.
I tried:
networks:
frontend:
aliases:
- test.localhost
- test2.localhost
backend:
aliases:
- test.localhost
- test2.localhost
But it didn't helped.