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 container in Azure and expose it to the internet with a public IP address. This operation is completed in a single command. Within just a few seconds, you'll see this 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 two ways to launch the Cloud Shell:

Click Try It in the upper right corner of a code block. Cloud Shell in this article
Click the Cloud Shell button on the menu in the upper right of the Azure portal. Cloud Shell in the portal

You can use the Azure Cloud Shell or a local installation of the Azure CLI to complete this quickstart. If you choose to install and use the CLI locally, this quickstart requires that you are running the Azure CLI version 2.0.21 or later. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.

Create a resource group

Azure Container Instances are Azure resources and must be placed in an Azure resource group, a logical collection into which Azure resources are deployed and managed.

Create a resource group with the az group create command.

The following example creates a resource group named myResourceGroup in the eastus location.

az group create --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 az container create command. You can optionally expose the container to the internet with a public IP address. In this quickstart, you deploy a container that hosts a small web app written in Node.js.

az container create --name mycontainer --image microsoft/aci-helloworld --resource-group myResourceGroup --ip-address public --ports 80

Within a few seconds, you should get a response to your request. Initially, the container is in the Creating state, but it should start within a few seconds. You can check the status using the az container show command:

az container show --name mycontainer --resource-group myResourceGroup

At the bottom of the output, you will see the container's provisioning state and its IP address:

"ipAddress": {
      "ip": "",
      "ports": [
          "port": 80,
          "protocol": "TCP"
    "osType": "Linux",
    "provisioningState": "Succeeded"

Once the container moves to the Succeeded state, you can reach it in your browser using the IP address provided.

App deployed using Azure Container Instances viewed in browser

Pull the container logs

You can pull the logs for the container you created using the az container logs command:

az container logs --name mycontainer --resource-group myResourceGroup


listening on port 80
::ffff: - - [29/Nov/2017:20:48:50 +0000] "GET / HTTP/1.1" 200 1663 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
::ffff: - - [29/Nov/2017:20:48:50 +0000] "GET /favicon.ico HTTP/1.1" 404 150 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"

Delete the container

When you are done with the container, you can remove it using the az container delete command:

az container delete --name mycontainer --resource-group myResourceGroup

To verify that the container has been deleted, execute the az container list command:

az container list --resource-group myResourceGroup -o table

The mycontainer container should not appear in the command's output. If you have no other containers in the resource group, no output is displayed.

Next steps

All of the code for the container used in this quickstart is available on GitHub, along with its Dockerfile. If you'd like to try building it yourself and deploying it to Azure Container Instances using the Azure Container Registry, continue to the Azure Container Instances tutorial.

To try out options for running containers in an orchestration system on Azure, see the Service Fabric or Azure Container Service (AKS) quickstarts.