Skip to content

Lab 10: Run a container in seconds

At a glance

  • Time: about 20 minutes
  • Region: Southeast Asia
  • You create: 1 container instance (0.5 CPU, 0.5 GB)
  • Cost: a few cents an hour while it exists. Delete it at the end.

What you will learn

  • What Azure Container Instances (ACI) is: the quickest way to run a container, with no servers to manage.
  • How to run a container from a public image and reach it from the internet.
  • How to read the container's logs and how to stop and start it.

What is different in this environment

  • You run in Southeast Asia, in your own resource group.
  • You make the container small: 0.5 CPU and 0.5 GB. Larger sizes cost more, and the lab limit is 2 CPU and 4 GB.
  • You turn off container logs to Log Analytics, because that workspace bills per GB. You still read the logs from the container itself.
  • You use a public image. Private registries aren't part of this lab.
Diagram: a container instance lab-c1 with 0.5 CPU and 0.5 GB, reached from a browser through a DNS name, with stop and start, and a size limit that blocks larger containers.
One small container, reached through its public name, with a size limit. Select the diagram to open it full size.

Before you start

  • You are signed in to the lab directory (Getting started).
  • Your lab resource group is rg-CLOUD-LAB-GRP-N. Replace N with your group number.
  • Delete the VMs and the scale set from Lab 08, if you still have them.
  • Each group may have only 1 container instance.

Task 1: Deploy a container instance

  1. Search for Container instances and select + Create.
  2. On Basics:

    Setting Value
    Resource group rg-CLOUD-LAB-GRP-N
    Container name lab-c1
    Region Southeast Asia
    SKU Standard
    Image source Quickstart images
    Image mcr.microsoft.com/azuredocs/aci-helloworld:latest (Linux)
  3. Select Change size and set Number of CPU cores to 0.5 and Memory (GiB) to 0.5. Select OK.

  4. Select Next: Networking. Set DNS name label to aci-grp-N- plus 5 random letters or digits, for example aci-grp-12-k7x3q.

    The label must be unique

    Your container is reached at <label>.southeastasia.azurecontainer.io. If you see DNS name label not available, change the label.

  5. Select Next: Monitoring. Clear the box Enable container instance logs.

  6. Select Next: Advanced and take the defaults. Select Review + create, then Create. This takes 2 to 3 minutes.

Keep it small

A container with more than 2 CPU or 4 GB, a Spot container or a GPU container is blocked with [LAB-P09A-CONTAINER-INSTANCE].

Task 2: Test the container

  1. Select Go to resource. On the Overview page, check that Status is Running.
  2. Copy the FQDN, open it in a new browser tab and check that you see Welcome to Azure Container Instances. Refresh a few times.
  3. Back in the portal, under Settings, select Containers, then Logs.
  4. You should see lines for the web requests from your browser.

Think about it

The container has a public address and no firewall in front of it. What would you do before putting a real application on it?

Task 3: Stop, start and see the guardrail

Stop and start

  1. On the Overview page, select Stop and confirm. Wait until the status is Stopped, and try the FQDN. It no longer answers.
  2. Select Start. When the status is Running, the FQDN answers again.

Try a size that isn't allowed

  1. Search for Container instances and select + Create.
  2. Use your resource group, the name lab-c2, the quickstart image, and Change size to 4 CPU cores.
  3. Go to Review + create. The validation fails with a message that starts with [LAB-P09A-CONTAINER-INSTANCE]. Read it.
  4. Close the form without creating anything.

Why you don't create it

Each group may have only 1 container instance. A second one that passes validation would be deleted automatically a few minutes later. This step only shows you the size rule.

Task 4: Clean up

  1. Open lab-c1 and select Delete. Confirm.
  2. Check that your resource group has no container instance left.

Check your work

  • lab-c1 was Running, and its FQDN showed the welcome page.
  • The logs showed your web requests.
  • A 4-CPU container was blocked with [LAB-P09A-CONTAINER-INSTANCE].
  • Your resource group is empty again.

Key points

  • ACI runs a container directly, with no VM or cluster to manage. You pay per second for the CPU and memory you request.
  • Size matters: request only what the container needs.
  • A container group has a public address only if you give it a DNS label.
  • Stop containers when you don't need them, and delete them when you finish.