如何使用 Azure Web 应用容器公开端口 3000? [英] How do you expose port 3000 using an Azure Web App Container?
问题描述
我正在托管的 docker 容器中运行 react 样板应用程序Azure Web 应用容器.
I'm running a react boilerplate app within a docker container, hosted Azure Web App Containers.
在本地,我使用以下方式启动应用程序:
Locally, I spin the app up with:
docker run -p 3000:3000 431e522f8a87
我的 docker 文件如下所示:
My docker file looks like this:
FROM node:8.9.3
EXPOSE 3000
RUN mkdir -p src
WORKDIR /src
ADD . /src
RUN yarn install
RUN yarn build
CMD ["yarn", "run", "start:prod"]
应用程序设置
我尝试使用键/值对编辑应用程序设置,但无济于事:WEBSITES_PORT=3000
I've tried editing the Application Settings, to no avail, with the key/value pair: WEBSITES_PORT=3000
80: 应用服务环境中应用服务计划中运行的应用的入站 HTTP 流量的默认端口.在启用 ILB 的 ASE 上,此端口绑定到 ASE 的 ILB 地址.
80: Default port for inbound HTTP traffic to apps running in App Service Plans in an App Service Environment. On an ILB-enabled ASE, this port is bound to the ILB address of the ASE.
443: 应用服务环境中应用服务计划中运行的应用的入站 SSL 流量的默认端口.在启用 ILB 的 ASE 上,此端口绑定到 ASE 的 ILB 地址.
443: Default port for inbound SSL traffic to apps running in App Service Plans in an App Service Environment. On an ILB-enabled ASE, this port is bound to the ILB address of the ASE.
如何在 Azure 应用服务中公开端口 3000?
推荐答案
用户 4c74356b41 是正确的.
在APPLICATION SETTINGS中,您需要设置键/值对WEBSITES_PORT.
In APPLICATION SETTINGS you need to set the key / value pair WEBSITES_PORT.
由于某种原因,它不适用于此图像,但我通过另一个示例并通过命令行完成了所有操作,并且效果很好.
For some reason it's not working on this image, but I went through another example and did it all through the command line, and it worked fine.
这篇关于如何使用 Azure Web 应用容器公开端口 3000?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!