- Create Azure Container Registry
- Tag image to be pushed into ACR
- Push image into ACR
- Create Azure Container Instance from ACR image
I can run Solr+SSL docker container and a bit more flexible Solr+SSL container with Sitecore indexes on my local machine. In this exercise I push my local Docker image into Azure Container Registry (ACR) and then create Azure Container Instance (ACI) to run my container in Azure.
You need Azure CLI 2.0 to run scripts in this article. The version should be >= 2.0.13.
I used this tutorial to experiment with ACR and ACI.
Create Azure Container Registry
First, create ACR in your Azure subscription to hold your container images.
az acr create -n myregistry -g mygroup --location westcentralus --sku Managed_Basic --admin-enabled true
Complete PowerShell script create-acr.ps1
At the time I used Azure containers not all regions supported Managed sku options. Most regions have
Basic(a.k.a. Classic) storage for ACR which is tied to a storage account. If you want to use Managed storage, then explore which regions support it. I found a few:
Basic(Classic) storage option for ACR does not allow to delete uploaded images.
Managedoptions didn’t seem to have this limitation.
Once the registry is created its full name should be
Tag image to be pushed into ACR
To upload a container image into your ACR, you have to tag it with full ACR name first. I used flexible Solr+SSL image for this.
docker tag solrssl-flex:6.6.0 myregistry.azurecr.io/solrssl-flex:6.6.0
docker images to make sure your new tagged image is listed.
Push image into ACR
This is done by means of
docker push command.
docker push myregistry.azurecr.io/solrssl-flex:6.6.0
Complete PowerShell script example push-image2acr.ps1.
Create Azure Container Instance from ACR image
To create container instance in Azure from ACR image run this command:
$acrPwd=$(az acr credential show -n myregistry --query "passwords.value") az container create -g mygroup -n mysolr --image myregistry.azurecr.io/solrssl-flex:6.6.0 --cpu 1 --memory 1.5 --registry-password $acrPwd --ip-address public --port 8983
If you want to pass a command line to be executed at the time container instance is created you can that via ` –command-line ‘my-script.sh’` parameter.
Complete PowerShell script deploy-aci-from-acr.ps1.