![](/img/trans.png)
[英]Node/Express Backend with Angular Front End in a Single Azure Web App
[英]Azure web app multi container (MEAN app), what is the URL to connect to node backend container from front end container?
Trying to learn to deploy angular app to azure web app using multi-container, the frontend loads fine but cant connect to the backend node container, I want to add the url of the node backend to my angular frontend but i cant figure out what it是。 I've tried https://rojesh.azure.io:3000 , https://rojesh.azurewebsites.net:3000 , http://server:3000 and more but nothing seems to work. 网站主机名: https://rojesh.azurewebsites.net,acr名称为 rojesh.azurecr.io,其中包含 3 个图像。 这是我在 azure 中撰写的配置文件:
version: '3.3'
services:
db:
image: rojesh.azurecr.io/db:latest
ports:
- "27017:27017"
restart: always
networks:
- app-network
server:
image: rojesh.azurecr.io/server:latest
depends_on:
- db
ports:
- "3000:3000"
restart: always
networks:
- app-network
app:
depends_on:
- server
image: rojesh.azurecr.io/app:latest
environment:
NGINX_HOST: rojesh.azurewebsites.net
NGINX_PORT: 80
ports:
- "80:80"
restart: always
networks:
- app-network
networks:
app-network:
driver: bridge
该应用程序使用 docker compose 在本地运行良好,即:
version: '3.9'
services:
docker-app:
build:
context: app
dockerfile: Dockerfile.dev
ports:
- '4200:4200'
volumes:
- ./app/src:/app/src
docker-server:
build:
context: server
dockerfile: Dockerfile
environment:
PORT: 3000
MONGODB_URI: mongodb://mongo:27017/rojesh
JWT_SECRET: secret
ports:
- 3000:3000
depends_on:
- mongo
volumes:
- ./server:/server
mongo:
container_name: mongo-server
image: mongo:latest
ports:
- 27017:27017
谢谢@ ajkuma-msft 。 Azure App Service 仅公开端口80
和443
。 是的,来自客户端的传入请求将超过443/80
,应该映射到容器的暴露端口。
应用服务将尝试检测将哪个端口绑定到您的容器。 如果您想将WEBSITES_PORT应用程序设置绑定到您的容器,并使用端口值对其进行配置。
Web App for Containers 目前只允许您向外界公开一个端口。 容器只能在单个端口上侦听 HTTP 请求。
从 Docker 组成配置的角度来看: 80
和8080
以外的端口被忽略。
请参阅Docker Compose 选项列表显示支持和不支持的 Docker Compose 配置选项。
参考这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.