How to communicate from one PHP container to another

Thanks tekki.

So I have created 3 new containers to try and figure out what could be wrong.
docker-compose.yml

version: ‘2.4’
services:
web:
image: nginx:latest
ports:
- “8080:80”
volumes:
- …/tests:/code
- ./.docker/nginx/conf.d/:/etc/nginx/conf.d
links:
- php1
php1:
build:
context: ./.docker
dockerfile: Dockerfile
volumes:
- …/tests:/code
php2:
build:
context: ./.docker
dockerfile: Dockerfile
volumes:
- …/tests:/code

Dockerfile

FROM php:7.2-fpm
RUN cd /usr/local/etc
&& {
echo ‘[global]’;
echo ‘daemonize = no’;
echo;
echo ‘[www]’;
echo ‘listen = 0.0.0.0:9000’;
} | tee php-fpm.d/zz-docker.conf

site.conf

server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /code/public;
location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass php1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
gzip_static on;
}
}

I build these 3 containers with

docker-compose up --build -d

If I go to localhost:8080 I get the results of php1:9000, so the container is accessible from the nginx container.
although, If I try to access the container from within container php2, again I get:

curl -i php1:9000
curl: (56) Recv failure: Connection reset by peer

I have tried another configuration where I use 2 php7.3-apache containers and this configuration does not give any errors. These off-course communicate over apache and not directly through the php setup.

Is there a way I can have 1 nginx container with multiple php containers where the php containers are able to communicate with each other?