简体   繁体   中英

Azure Web App for Containers not setting Environment Variables

I have a docker image being deployed from Azure Container Registry. Everything works fine except that I expect to be able to see environment variables being passed to my running docker image from the Application Settings configured in the portal. It is a Node app accessing environment variables with process.env.VariableName.

As an example its says here https://blogs.msdn.microsoft.com/waws/2017/09/08/things-you-should-know-web-apps-and-linux/#SetEnvVar … "App Settings are injected into your app as environment variables at runtime"

I have tried the following.

  • Setting Applications Settings in the Azure Portal. These are supposed to get passed to the running Docker image as per the documentation but process.env.VariableName in my Node application is not set.

  • I have tried using a Docker compose file that sets the environment variables but again process.env.VariableName is empty.

  • I have even updated the VSTS build arguments passing the Variable to my Docker file on build which in turn sets the environment variable. Again no variable passed to the running Docker image.

My conclusion is that custom environment variables are not allowed in Azure Web App for Containers?

Am I doing something wrong?

根据文档,应用程序设置作为环境变量注入到进程中,但是环境变量名称以APPSETTING_为前缀,因此在您的 Node 应用程序中,您需要使用process.env.APPSETTING_VariableName访问应用程序设置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM