1

I have an azure container instance running in a vnet within a subnet. I have been (until now) able to update the image of this container instance with a command like this one:

az container create \
   --resource-group my_rg\
   --name containername \
   --image containerregistry.azurecr.io/myimage:latest \
   --registry-login-server containerregistry.azurecr.io \
   --registry-username username \
   --registry-password password \
   --vnet my_vnet \
   --subnet my_subnet

Until now, when I needed to update the image in my container, I would build it, push it to my container registry in azure, and run this command.

The container would stop and restart with the new image.

It may not be the issue but I upgraded my azure cli recently, I am now on version 2.34.1. When I run this command now I get this message:

(NetworkProfileCannotChange) The network profile of existing container group 'containername' cannot be changed. To change a network profile, you must delete and then create the container group with the changed property.
Code: NetworkProfileCannotChange

I don't want to change my network profile, I just want to update the image. I have seen it with az network profile list --resource-group my_rg It looks fine for me. I have double checked, my vnet and my subnet have not changed. I don't understand why this command does not work anymore.

Any idea of what's happening ?

Cheers

Nicolas C
  • 752
  • 5
  • 18
  • 1
    Thanks for the answer, I know how stackoverflow works, so I know how to accept an answer, just give me some time to test the solution. – Nicolas C Mar 09 '22 at 10:45

1 Answers1

0

Tested in my enviroment it is working fine for me with both the version.

Earlier i was using the AZ CLI version 2.32.0 able to create the Container.

enter image description here enter image description here

Now i have updated the AZ CLI version to 2.34.1 and trying to change or update the image of container using the same command with same existing VNET and Subnet

enter image description here enter image description here

Getting Simmillar Kind of Error when i am changing the Subnet name.

enter image description here

Suggestion 1 : Would suggest you to recheck if your existing container is not taking another subnet or VNET when you are creating container with updated images.

Suggestion 2 : Sometimes it might stopes you to update the Image on Running and exist conatainer, you get this error: "If you are going to update the os type, restart policy, network profile, CPU, memory or GPU resources for a container group, you must delete it first and then create a new one"

Suggestion 3 : TO avoid the recreation of conatainer scheduled container instance that is running once a day. Whenever it starts it is pulling the docker image with the :latest tag from the azure container registry. This avoids re-creation of the container group.

For more information You can refer this https://circleci.com/blog/azure-custom-images/ and Related Issue

RahulKumarShaw
  • 4,192
  • 2
  • 5
  • 11
  • 1
    Well thanks for the answer, I'm not sure why but it went from 1 CPU to 2 CPU, so I had to delete de container to recreate it. – Nicolas C Mar 14 '22 at 09:07