Search code examples
azuredockerazure-cloud-shell

Azure WebApp container restart issue


I've created an web app running the grafana docker image as this

az group create --name grp-test-container-1 
                --location "West Europe"
az appservice plan create --name asp-test-container-1 
                          --resource-group grp-test-container-1 
                          --sku B1 
                          --is-linux
az webapp create --resource-group grp-test-container-1 
                 --plan asp-test-container-1 
                 --name app-test-container-1 
                 --deployment-container-image-name grafana/grafana:latest

Then I updated the appsettings in order to pass env variables to the docker run command

az webapp config appsettings set --name app-test-container-1 
                                 --settings GF_INSTALL_PLUGINS='grafana-azure-monitor-datasource' 
                                 --resource-group grp-test-container-1

Then I need to restart the container in order to get the added env variable in the docker run command.

I tried to restart the web app, stop/start it, change the docker image name and save under the Container Settings.. nothing works

enter image description here

Any suggestions?

Solution/Bug

As Charles Xu said in his answer, to reload the container you need to change the docker image and save in order to make the web app fetch the image again and apply the added env variables.

In my case, I did that change and then looked at the log output but the log never got updated. I waited 5-10 minutes and still no logs were added..

But when I visit the site and browsed to the extension, which were installed by the env varibles, I could se that it all had gone through.

So, to summarize: The log in the Container Settings are not to be trusted, when doing a change those changes might not show up in the log.


Solution

  • What you need to do is change the image from grafana/grafana:latest into grafana/grafana, just delete the version latest and click the save button below. Then it will work.

    enter image description here

    enter image description here