![](/img/trans.png)
[英]Can't connect to php7 fpm docker container from within an apache 2 docker container
[英]Can't Curl docker container running apache from outside the container
我无法 curl 我的 php 从常规终端运行 Apache。 在容器内卷曲 localhost 会返回正确的结果。
docker-compose 文件:
version: '3'
services:
dash-api:
build:
context: .
dockerfile: Dockerfile
args:
- GITHUB_HTTPS_TOKEN=<token>
volumes:
- /usr/local/:/usr/local/
- /app:/var/www/html
ports:
- "80:80"
Dockerfile
FROM php:7.2.34-apache AS serve
...
EXPOSE 80
CMD ["apachectl", "-D", "FOREGROUND"]
docker 日志在请求中显示 500 错误(来自容器外部)
127.0.0.1 - - [25/Nov/2021:12:05:46 +0000]“GET /gateway.php HTTP/1.1”500 1047“-”“curl/7.54.0”
但是卷曲一个测试文件(位于与 gateway.php 相同的文件夹中,其中包含一个回显会返回 output。
尝试在端口旁边添加 localhost,也许这会有所帮助。
version: '3'
services:
dash-api:
build:
context: .
dockerfile: Dockerfile
args:
- GITHUB_HTTPS_TOKEN=<token>
volumes:
- /usr/local/:/usr/local/
- /app:/var/www/html
ports:
- 127.0.0.1:80:80
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.