Hi friends, this question has been fruitless for several days:
A PHP container is running in the Docker on my Mac, using the official php:5.6-fpm image. The IP address is 172.17.0.4
.there is another server that provides the interface. In the intranet, the IP address is 192.168.1.249.
in order to access the interface in the container, I added a hosts to the PHP container to access the interface server:
-sharp docker exec -it php56 bash
-sharp cat /etc/hosts
...
172.17.0.4 589ce93fa246
192.168.1.249 api.test.com
the code for the access interface is as follows:
curl("http://api.test.com/articles"); // curl
however, the problem is that although this interface can be accessed, it takes at least 5 seconds to return the result.
There is no problem with the interface itself. Both browser and postman access can be accessed normally in the host, and the speed is about tens of milliseconds. There should be no problem with the code called by
, and the curl function can be accessed properly by running the curl function in cli mode on the host.
I think it should be the problem of dns, but I don"t understand dns,. I hope you can give us some advice. Thank you very much.