Hi Chandra Pal, Madhab ,
Welcome to the Microsoft Q&A Platform!
To configure custom environment variables for Docker containers running behind Azure App Service,Since App Service doesn't allow direct modification of the container runtime environment outside the options provided by the App Settings interface.
- Navigate to your Azure App Service in the Azure Portal.
- Go to the Configuration section under Settings.
- Click on Application Settings.
- Add your custom environment variables by specifying their Key and Value. For example:
- Key:
DT_CUSTOM_VARIABLE
- Value:
some_value
- Save the changes. These variables will be injected into the environment of your container.
- Ensure that your Docker container is configured to read these environment variables.
- In your Dockerfile or application code, access the variables using the appropriate method .
- After saving the changes, restart your App Service to ensure the new environment variables are applied to the running container.
- you can verify that the variables have been set correctly by Using the Kudu console.
- Navigate to your Web App in the Azure Portal.
- Go to Development Tools > Advanced Tools (Kudu) > Go.
- Open the debug console and use commands like
printenv
orcat /proc/1/environ
to inspect the container's environment variables. - Pass Environment Variables Directly in Docker Compose (if applicable).If you are deploying using a custom Docker Compose file, include the environment variables in the
environment
.
version: '3.8'
services:
app:
image: your-image
environment:
- DT_CUSTOM_VARIABLE=some_value
- Ensure that your custom variables are aligned with Dynatrace's requirements.
https://learn.microsoft.com/en-us/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet#app-environment
https://docs.dynatrace.com/docs/manage/tags-and-metadata/setup/define-tags-based-on-environment-variables
Let me know if you have any further assistances.