Search code examples
linuxazurecontainersazure-container-apps

Configure Timezone in Azure Container App (Linux)


Does anyone know how to configure the timezone in an azure container app? I've tried setting it through terminal which works temporarily using the commands:

- cd /usr/share/zoneinfo
- tzselect

But then I need to update the .profile file but need permission to access it by running ~/.profile in terminal. Typing this command in gives me a "Permission denied" error in the terminal.

But then do I need to update .profile or will it be permanent anyway for that container app?


Solution

  • The best method to configure the custom time zone in azure container apps is to pass an environment variable. You can pass environment variable to container apps in two ways. One way is to add environment variable in the Dockerfile, build and deploy the custom docker image to the container apps. Below is an example of dockerfile with custom time zone.

    FROM  nginx
    ENV  TZ=Asia/Kolkata
    COPY  index.html  /usr/share/nginx/html/index.html
    

    Another way is to add an environment variable while creating container app instance. enter image description here Verify the time zone by connecting to container once deployed.

    enter image description here