In this example we are going to set up two dockerised PHP-FPM and Nginx applications (“frontend” and “backend”) and allow them to communicate each other over the same network. There are three critical points here:

  • Set COMPOSE_PROJECT_NAME to inanzzz in “.env” file of both projects. This will create a network called inanzzz_default and place both project’s containers into it so that they can talk to each other.

  • The nginx port forwarding should be different in “docker-compose.yml” file for both projects - e.g. 8081 and 8082.

  • Service names should be different in “docker-compose.yml” file for both projects - e.g. frontend_php and backend_php so on.

#docker #linux #nginx #php-fpm

Multiple Dockerised PHP-FPM and Nginx Applications Communicating Each
1.25 GEEK