Quickstart: Create your first container in Azure Container Instances

Azure Container Instances makes it easy to create and manage Docker containers in Azure, without having to provision virtual machines or adopt a higher-level service. In this quickstart, you create a Windows container in Azure and expose it to the internet with a fully qualified domain name (FQDN). This operation is completed in a single command. Within just a few moments, you can see the running application in your browser:

App deployed using Azure Container Instances viewed in browser

If you don't have an Azure subscription, create a free account before you begin.

Launch Azure Cloud Shell

The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account. Just click the Copy to copy the code, paste it into the Cloud Shell, and then press enter to run it. There are a few ways to launch the Cloud Shell:

Click Try It in the upper right corner of a code block. Cloud Shell in this article
Open Cloud Shell in your browser. https://shell.azure.com/powershell
Click the Cloud Shell button on the menu in the upper right of the Azure portal. Cloud Shell in the portal

If you choose to install and use the PowerShell locally, this tutorial requires the Azure PowerShell module version 5.5 or later. Run Get-Module -ListAvailable AzureRM to find the version. If you need to upgrade, see Install Azure PowerShell module. If you are running PowerShell locally, you also need to run Login-AzureRmAccount to create a connection with Azure.

Create a resource group

Create an Azure resource group with New-AzureRmResourceGroup. A resource group is a logical container into which Azure resources are deployed and managed.

New-AzureRmResourceGroup -Name myResourceGroup -Location EastUS

Create a container

You can create a container by providing a name, a Docker image, and an Azure resource group to the New-AzureRmContainerGroup cmdlet. You can optionally expose the container to the internet with a DNS name label.

Execute the following command to launch a Nano Server container running Internet Information Services (IIS). The -DnsNameLabel value must be unique within the Azure region you create the instance, so you might need to modify this value to ensure uniqueness.

New-AzureRmContainerGroup -ResourceGroupName myResourceGroup -Name mycontainer -Image microsoft/iis:nanoserver -OsType Windows -DnsNameLabel aci-demo-win

Within a few seconds, you should receive a response to your request. The container is initially in the Creating state, but it should start within a minute or two. You can check the deployment status by using the Get-AzureRmContainerGroup cmdlet:

Get-AzureRmContainerGroup -ResourceGroupName myResourceGroup -Name mycontainer

The container's provisioning state, fully qualified domain name (FQDN), and IP address appear in the cmdlet's output:

PS Azure:\> Get-AzureRmContainerGroup -ResourceGroupName myResourceGroup -Name mycontainer

ResourceGroupName        : myResourceGroup
Id                       : /subscriptions/<Subscription ID>/resourceGroups/myResourceGroup/providers/Microsoft.ContainerInstance/containerGroups/mycontainer
Name                     : mycontainer
Type                     : Microsoft.ContainerInstance/containerGroups
Location                 : eastus
Tags                     :
ProvisioningState        : Creating
Containers               : {mycontainer}
ImageRegistryCredentials :
RestartPolicy            : Always
IpAddress                :
DnsNameLabel             : aci-demo-win
Fqdn                     : aci-demo-win.eastus.azurecontainer.io
Ports                    : {80}
OsType                   : Windows
Volumes                  :
State                    : Pending
Events                   : {}

Once the container ProvisioningState moves to Succeeded, navigate to its Fqdn in your browser:

IIS deployed using Azure Container Instances viewed in browser

Delete the container

When you are done with the container, you can remove it using the Remove-AzureRmContainerGroup cmdlet:

Remove-AzureRmContainerGroup -ResourceGroupName myResourceGroup -Name mycontainer

Next steps

In this quickstart, you started a pre-built Windows container in Azure Container Instances. If you'd like to try building a container yourself and deploying it to Azure Container Instances using the Azure Container Registry, continue to the Azure Container Instances tutorial.