[英]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 is. 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.
I've tried https://rojesh.azure.io:3000 , https://rojesh.azurewebsites.net:3000 , http://server:3000 and more but nothing seems to work. Website Hostname: https://rojesh.azurewebsites.net and the acr name is rojesh.azurecr.io which has 3 images.
网站主机名: https://rojesh.azurewebsites.net,acr名称为 rojesh.azurecr.io,其中包含 3 个图像。 This is my config file for compose in azure:
这是我在 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
The app works fine locally using docker compose which is:该应用程序使用 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
Thanks @ ajkuma-msft .谢谢@ ajkuma-msft 。 Azure App Service only exposes ports
80
and 443
. Azure App Service 仅公开端口
80
和443
。 Yes, incoming requests from client would just be over 443/80
which should be mapped to the exposed port of the container .是的,来自客户端的传入请求将超过
443/80
,应该映射到容器的暴露端口。
App Service will attempt to detect which port to bind to your container.应用服务将尝试检测将哪个端口绑定到您的容器。 If you want to bind to your container the WEBSITES_PORT app setting and configure it with a value of the port.
如果您想将WEBSITES_PORT应用程序设置绑定到您的容器,并使用端口值对其进行配置。
Web App for Containers currently allows you to expose only one port to the outside world. Web App for Containers 目前只允许您向外界公开一个端口。 The container can only listen for HTTP requests on a single port.
容器只能在单个端口上侦听 HTTP 请求。
From Docker compose configuration stand-point: Ports other than 80
and 8080
are ignored.从 Docker 组成配置的角度来看:
80
和8080
以外的端口被忽略。
Refer Docker Compose options lists shows supported and unsupported Docker Compose configuration options.请参阅Docker Compose 选项列表显示支持和不支持的 Docker Compose 配置选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.