简体   繁体   English

Web 应用环境变量上的 Azure Linux 容器

[英]Azure Linux container on Web app environmental variables

I have a configuration that runs a Node docker container on azure as a Webapp.我有一个在 azure 上运行 Node docker 容器作为 Webapp 的配置。 Everywhere i read it clearly says that App Settings ( environmental variables ) set to the Web app will be injected at runtime to the container, but it's clearly not the case for me.我读到的任何地方都清楚地表明,设置为 Web 应用程序的应用程序设置(环境变量)将在运行时注入到容器中,但对我来说显然不是这种情况。

"When your app runs, the App Service app settings are injected into the process as environment variables automatically" “当您的应用程序运行时,应用程序服务应用程序设置会作为环境变量自动注入到进程中”

https://docs.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#configure-environment-variables https://docs.microsoft.com/en-us/azure/app-service/configure-custom-container?pivots=container-linux#configure-environment-variables

Dockerfile: Dockerfile:

FROM node

# Open SSH for Azure
RUN apt-get update && apt-get install -y ssh
RUN echo "root:Docker!" | chpasswd
RUN mkdir /run/sshd
COPY sshd_config /etc/ssh/

# Copy resources
WORKDIR /app
COPY package*.json ./

# Run install
RUN npm install
COPY . .

# Copy startup script and make it executable
COPY startup.sh /app
RUN ["chmod", "+x", "/app/startup.sh"]

startup.sh:启动文件:

#!/bin/sh

echo "Start sshd"
/usr/sbin/sshd

echo "Start node"
node server.js

And still (as an example):仍然(例如):

secret: process.env.ADDSEARCH_SECRET

And still process.env.ADDSEARCH_SECRET clearly returns null.仍然 process.env.ADDSEARCH_SECRET 明确返回 null。 As well as all the reset of the variables以及所有变量的重置

Azure 环境映像

What am I missing?我错过了什么?

Using it with build_args during the build step of the docker image works, but I really don't want to do it that way for several reasons.在 docker 映像的构建步骤中将它与 build_args 一起使用是有效的,但出于多种原因,我真的不想这样做。

您需要在环境变量前加上APPSETTING_前缀,例如APPSETTING_ADDSEARCH_SECRET

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过 ssh 进入 Azure 上的“Web App On Linux”docker 容器? - How can I ssh into “Web App On Linux” docker container on Azure? Azure 环境变量如何覆盖 web.config 值? - Azure Environmental Variables how to override web.config value? Azure Key Vault环境变量 - Azure Key Vault Environmental Variables Azure Web 自定义容器中的应用程序,环境变量未从应用程序服务传播到容器 - Azure Web App in custom container, env variables not propagated from app service to container 在带有 IdentityServer4 认证/http 错误的 azure Web 应用容器上部署 .net Core 3 linux 容器 - Deploying .net Core 3 linux container on azure web app container with IdentityServer4 certification/http error 容器端口 Issue Azure Web App as Container - Container Port Issue Azure Web App as Container Azure 容器注册表授权 Azure Web 应用程序 - Azure Container Registry authorization for Azure Web App 如何在 Azure web 应用程序 web.config 文件中添加/设置新的环境变量 - How to add/set new environmental varaible in Azure web app web.config file Azure Linux 容器 Web 应用程序未使用私有 ZED5F2BDECBD4BD349FBZD094 解析 vnet 中的名称 - Azure Linux Container Web App does not resolve name within the vnet using private DNS 用于 Linux 容器的 Azure Web 应用服务未从 docker-compose 文件中获取环境变量 - Azure web app service for Linux containers not picking up environment variables from docker-compose file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM