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?
Fetch Using docker exec Command Here, we are executing the /usr/bin/env utility inside the Docker container. Using this utility, you can view all the environment variables set inside Docker containers.
As per the documentation the app settings are injected into the process as environment variables, however the environment variable name is prefixed with APPSETTING_
, so in your Node application you would need to access the app setting with process.env.APPSETTING_VariableName
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With