[英]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以及所有变量的重置
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.