File_get_contents on localhost : Connection refused

Hi !
I’ve got a problem to access to my local files from a container.
I’ve got one nginx container and one php fpm container.
I can access to my php fpm container with the url local.api.fr:8080
but inside the php fpm container, if I do :
file_get_contents(‘local.api.fr:8080’) or file_get_contents(‘local. api. fr’), I’ve got a “failed to open stream: Connection refused.” (I’ve already add local. api. fr inside my php fpm container’s /etc/hosts file
This is a part of my docker-compose file :

Thanks you for your help
Cheers
Vincent.

Why dont you just access the node directly? instead of going out and then in again ?

Hi,
thanks for the answer.
I need to export a doc to PDF thanks to WkHtmlToPdf.
My doc contains images, and for security reason, I access them with a symphony route, and a gaufrette System… I don’t think I can do this without to use absolute url inside my twig template.

The use case with file_get_contents is just for the test : I think if the file_get_contents works, so my export works too.