简体   繁体   中英

Unable to set the environment variables on a NodeJS Container on Azure App Service

I have a containerized application with a docker file that requires 4 environment variables that have to be set during runtime otherwise the application fails. I typically set it on the host and have the host set the environment variable on the container. This works great on a K8 and local docker runs. However, I am trying to use Azure App Service to bring up the container. I deployed the container on the Azure Container registry and wired up the App Service to point to the container in the registry. I then set the Application Settings (which according to the documentation is used for environment variables on the run command ie https://docs.microsoft.com/en-us/azure/app-service/configure-common#configure-app-settings ) under Configuration of the Azure App Service and restart the application. I can see in the context of the host, the docker run command that is invoked and it does not set the environment variables. I have even added verbose logging in the containerized app and I can see in the context of the application, the env variables do not get set.

Am I missing a step in the configuration and setup? I can provide additional details if required

This ended up being a problem with the logging that Azure provides. It was not printing the logs in the correct order so I ended up showing errors. Also the logs do not show the environment variables passed in the docker run hence, the command look suspicious. After figuring out how to navigate the logs and reviewing the correct output, I was able to determine the. The Diagnosis and solve problems / Availability and Performance / Application Logs feature in Azure help a bunch in resolving this issue.

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