Update Container Image of Application Hosted in Azure Container Instances
  • 23 Sep 2022
  • 1 Minute to read
  • Contributors
  • Comment
  • Dark
    Light
  • PDF

Update Container Image of Application Hosted in Azure Container Instances

  • Comment
  • Dark
    Light
  • PDF

#ServerlessTips - Azure Container Instances
Author: Rahul Rai Azure MVP

You will likely update your application at some point. Azure Container Instances allow you to update the container image of the application using the same command that enables you to create it: az container create.

Updating the image of an application is one of the most common operations you will perform through your Continuous Delivery pipeline. An idempotent create command will significantly simplify the process for you. However, if you need to update any other aspect of the container, such as additional ports, restart policy, volume mount, etc., you will have to create a new container instance and delete the old one.

Let's build a quick demo to see this tip in action. Execute the following command to create a container instance that runs an old version of NGINX – 1.19.4:

az container create -g <RESOURCE GROUP NAME> --name my-nginx --image registry.hub.docker.com/library/nginx:1.19.4 --ports 80

You can inspect the image of the container provisioned on the Azure portal by clicking on the Containers option of the Container Instance as follows:

Picture1(20)

Let's reissue the command and use the latest tag of the NGINX image, which at the time of this writing is 1.23.1:

az container create -g <RESOURCE GROUP NAME> --name my-nginx --image registry.hub.docker.com/library/nginx:1.23.1 --ports 80

After successfully executing the command, refresh the list of containers in your Container Instance. You should see the image update reflected in the details as follows:

Picture2(18)


Was this article helpful?