如何使用 Azure Web 应用容器公开端口 3000? [英] How do you expose port 3000 using an Azure Web App Container?

查看:16
本文介绍了如何使用 Azure Web 应用容器公开端口 3000?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在托管的 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

显然 Azure 只为入站流量公开端口 80 和 443:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆