我创建了docker-compose.yml,它可以在我的计算机(本地)上运行,但不能在服务器(docker swarm,portainer)上运行。容器nginx无法看到php-fpm。
docker-compose.yml:
Program.pl
在/etc/nginx/conf.d/default中:
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
和entrypoint.sh用于Nginx-php-test:
...
fastcgi_pass fpm:9000;
...
如何连接到fpm容器?
答案 0 :(得分:0)
我找到了解决方法:
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
networks:
nginx-php:
driver: overlay