3
votes

Quite me to this stuff, but I seem to miss something. I push an image to a private Azure registry and spawned a container instance right through the portal. Works like a charm. Now I changed something, pushed again and... What do I do? Kill and delete the instance and recreate? Everytime? Br, Daniel

3

3 Answers

2
votes

Generally - yes. But you can create a webhook that will invoke something when a new image is pushed to the repo. That can act as a way to automate redeployment.

enter image description here

possible solution is to use Azure Managed DNS name for container:

az container create -n helloworld --image microsoft/aci-helloworld -g myResourceGroup --dns-name-label mycontainer

this way your dns name will always stay the same

2
votes

You don't need to delete every time! Just make sure your docker tag is always the same then after pushing you can just restart your app service.

tag example

docker tag myimage image.azure.ac/myimage:latest

latest in this case it's my tag

2
votes

Another good way to do this these days is to restart the container. You can run the Azure CLI command or do it from the front end.

az container restart -g="XXX" -n="XXX"

An added benefit is that your public IP stays the same.

https://docs.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest#az-container-restart