Before you begin

You must satisfy the following requirements to complete this tutorial:

Azure CLI: You must have Azure CLI version 2.0.29 or later installed on your local computer. Run az --version to find the version. If you need to install or upgrade, see Install the Azure CLI.

Docker: This tutorial assumes a basic understanding of core Docker concepts like containers, container images, and basic docker commands. For a primer on Docker and container basics, see the Docker overview.

Because the Azure Cloud shell does not include the Docker daemon, you must install both the Azure CLI and Docker Engine on your local computer to complete this tutorial. You cannot use the Azure Cloud Shell for this tutorial.

Deploy the container using the Azure CLI

In this section, you use the Azure CLI to deploy the image built in the first tutorial and pushed to Azure Container Registry in the second tutorial. Be sure you've completed those tutorials before proceeding.

Get registry credentials

When you deploy an image that's hosted in a private container registry like the one created in the second tutorial, you must supply credentials to access the registry. As shown in Authenticate with Azure Container Registry from Azure Container Instances, a best practice for many scenarios is to create and configure an Azure Active Directory service principal with pull permissions to your registry. See that article for sample scripts to create a service principal with the necessary permissions. Take note of the service principal ID and service principal password. You use these credentials when you deploy the container.

You also need the full name of the container registry login server (replace <acrName> with the name of your registry):

az acr show --name <acrName> --query loginServer

Deploy container

Now, use the az container create command to deploy the container. Replace <acrLoginServer> with the value you obtained from the previous command. Replace <service-principal-ID> and <service-principal-password> with the service principal ID and password that you created to access the registry. Replace <aciDnsLabel> with a desired DNS name.

Within a few seconds, you should receive an initial response from Azure. The --dns-name-label value must be unique within the Azure region you create the container instance. Modify the value in the preceding command if you receive a DNS name label error message when you execute the command.

Clean up resources

If you no longer need any of the resources you created in this tutorial series, you can execute the az group delete command to remove the resource group and all resources it contains. This command deletes the container registry you created, as well as the running container, and all related resources.

az group delete --name myResourceGroup

Next steps

In this tutorial, you completed the process of deploying your container to Azure Container Instances. The following steps were completed:

Deployed the container from Azure Container Registry using the Azure CLI

Viewed the application in the browser

Viewed the container logs

Now that you have the basics down, move on to learning more about Azure Container Instances, such as how container groups work: