I created docker-compose.yml which works on my computer (local) but not work on server (docker swarm, portainer). Container nginx can`t see php-fpm.
docker-compose.yml:
version: "3"
services:
nginx:
image: nginx-php-test:8
ports:
- "8888:80"
restart: always
environment:
- ROLE=nginx #run nginx
fpm:
image: nginx-php-test:8
environment:
- ROLE=fpm #run php
restart: always
in /etc/nginx/conf.d/default:
...
fastcgi_pass fpm:9000;
...
and entrypoint.sh for nginx-php-test:
#!/bin/bash
if [ "$ROLE" == "nginx" ]; then
exec /usr/sbin/nginx
elif [ "$ROLE" == "fpm" ]; then
exec /usr/sbin/php-fpm7.4 -F
fi
How to connect to the fpm container?