I have 2 docker-compose
files, 2 projects in Symfony 2.7 that need to communicate between them, let’s call them BO si BK.
I know they must be in the same network I have them set up with the same network name, but from the application I get timeout.
BK docker compose:
version: "3.1"
services:
bk-postgres:
image: postgres:9.5
container_name: bk-postgres
working_dir: /application
volumes:
- .:/application
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=bk
ports:
- "5000:5432"
networks:
- bo-network
- bk-network
bk-webserver:
image: nginx:alpine
container_name: bk-webserver
working_dir: /application
volumes:
- .:/application
- ./.docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8088:80"
networks:
- bo-network
- bk-network
bk-php-fpm:
build: .docker/php-fpm
container_name: bk-php-fpm
working_dir: /application
volumes:
- .:/application
- ./.docker/php-fpm/php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini
networks:
- bo-network
- bk-network
networks:
bo-network:
external: true
conseilsante-booking
driver: bridge
For the BO:
version: "3.1"
services:
bo-postgres:
image: postgres:9.5
container_name: bo-postgres
working_dir: /application
volumes:
- .:/application
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=bo
ports:
- "5002:5432"
networks:
- a-network
- conseilsante-backoffice-network
bo-webserver:
image: nginx:alpine
container_name: bo-webserver
working_dir: /application
volumes:
- .:/application
- ./.docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8089:80"
networks:
- a-network
- conseilsante-backoffice-network
bo-php-fpm:
build: .docker/php-fpm
container_name: bo-php-fpm
working_dir: /application
volumes:
- .:/application
- ./.docker/php-fpm/php-ini-overrides.ini:/etc/php/7.1/fpm/conf.d/99-overrides.ini
networks:
- a-network
- conseilsante-backoffice-network
networks:
a-network:
driver: bridge
conseilsante-backoffice-network:
driver: bridge
I installed ping and they respond from one to another, from the bk-php-fpm to the bo-webserver, I get a response, from bo-php-fpm to bk-webserver, I also get a response.
Now, the thing is that in the application I get an error from the curl client saying
Error: Maximum execution time of 30 seconds exceeded.
This is on both applications, so I don’t know why is this. I tried to add http://
to the name of the server, but it doesn’t connect.
The output of docker network ls
fd6334797bd4 bo-network bridge local
253a6c503049 bk-network bridge local
a545be055cfa bridge bridge local
27ee26530cde host host local
eb5701f013ae none null local
Without Docker, the application works without an issue, so this is for sure an issue with how I configured the path to the web servers.