我有两个不同的项目运行在不同的码头集装箱。下面是两个yml文件:
文件
Web服务器API/docker-compose.yml
version: "3.1"
services:
webserver:
image: nginx:alpine
container_name: webserver-api
working_dir: /application
volumes:
- .:/application
- ./docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8005:80"
文件
客户端app/docker-compose.yml
version: '3'
services:
web:
container_name: client-app
build:
context: ./
dockerfile: deploy/web.docker
volumes:
- ./:/var/www
ports:
- "8010:80"
links:
- app
app: [...]
database: [...]
从
客户端应用程序
我想打电话给
Web服务器API
.
当我试图从
Web服务器API
我收到消息“curl错误连接被拒绝”或超时错误。
例如
$response = file_get_contents('http:/localhost:8005/api/test');
我还尝试用
Web服务器API
这样的容器:
$response = file_get_contents('http://172.25.0.2:8005/api/test');
但是我还是得到了一个超时连接错误。
从客户端容器调用服务器容器的正确url是哪个?或者如何设置主机url?
非常感谢你的帮助和时间。