Creating Azure Container Instance - Step By Step Demo

There are multiple ways to create an Azure Container Instance as stated below.
  • You can create them directly in the Azure Portal
  • You can use the PowerShell cmdlets
  • You can use Azure Resource Manager Templates
  • You can use Azure Command Line Interface
In this demo, I will be using the Azure CLI because it is cross-platform and can be used across any platform. Also in the Azure CLI, the command syntax is very simple.
We are going to deploy a website running the open-source Ghost blogging platform.
Step 1
Login to your Azure account and switch to your preferred subscription.
Step 2
Save the resource group name and location name in their respective variables.
Step 3
Create a resource group by running the following command.
Step 4
Next, store the container group’s name in a variable.
Step 5
This command creates the container group. We have specified the resource group name, the container group name, the official Ghost image of the Ghost blogging platform which we are going to pull down from the Docker hub. The default port is 2368 by Ghost and we have specified that the IP address should be public and with that, we have given it a DNS label name.
Step 6
It will take some time for the container to be up and running so initially, it will show Pending in the provisioning state.
Step 7
To check the status, you can run the following command.
Step 8
You will be able to see after some time that it shows the provisioning state as succeeded. It would give a public IP address and a fully qualified domain name as well.
Step 9
If you access the domain name at port 2368, you will see something like this.
Step 10
So, you can say that this is a very fast way to get up and running with a bit of open-source software.
Supposing that we wanted it to run permanently, we would have found a cheaper way of hosting it, maybe by hosting the container on Azure App Service.
This is just an easy way to see how things are actually done.
Step 11
Next, let us see how we can access the logs of our container. You can simply run this command to see the container logs.
  • It is important to note that here in our container group, we just have a single container. Although we can have multiple containers in the same container group and can access the same through Azure CLI.
  • We are done with this part of the demo so we need to delete the resource group now.
  • You can also just delete the container group and that will stop the container and ensure that you are not paying anymore but it is a good practice to always delete the resource group just in case you might have created some additional resources as a part of your experiment. 
Step 12
You can delete the resource group by running this command with the –y flag that will confirm that yes, you really want to delete it.

Similar Articles