Restart Azure Container Instance
Asked Answered
P

4

5

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

Pleiad answered 4/7, 2018 at 18:39 Comment(0)
W
3

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://learn.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest#az-container-restart

Womack answered 7/12, 2018 at 11:6 Comment(2)
No you would have to do a build and a push firstWomack
you need to do az container create to the upgrade. However, this is useful because I have seen ACI not showing the new changes. Restarting it (with this command) helps for this.Charron
P
2

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

Patron answered 9/12, 2019 at 14:15 Comment(0)
E
1

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

Expellee answered 4/7, 2018 at 19:0 Comment(3)
That's dumb. I'll lose the public IP everytime then.Pleiad
Sure, I wouldn't mind to kill, remove, create again, if I wouldn't lose the public IP then.Pleiad
Will look into that asap.Pleiad
E
1

Just restart the container using the portal like the following: enter image description here

Or use the following Azure CLI command if the container is on a running state.

az container restart --name <container_instance_name> --resource-group <RG_name>

To confirm the successful pull/update of the image, you should see a pull event before the start event near the time you restarted, like the following: enter image description here

Elflock answered 25/8, 2022 at 13:54 Comment(2)
Hello @Wail, this requieres that the container was created with tag latest, doesn't it?Compulsive
@KenJiiii my apologies for the late reply, it can be latest or any other tag that's getting updated, depending on your tagging strategy of course. If you are relying only on build, version or commit tags for example, this won't work for you.Elflock

© 2022 - 2024 — McMap. All rights reserved.