0
0
Azurecloud~10 mins

Azure Container Instances (ACI) for simple runs - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Azure Container Instances (ACI) for simple runs
Create Container Group
Specify Container Image
Set CPU and Memory
Configure Networking
Deploy Container Instance
Container Starts Running
Container Completes or Stops
View Logs or Output
Delete Container Instance
This flow shows how you create and run a simple container in Azure Container Instances, from setup to cleanup.
Execution Sample
Azure
az container create --resource-group myGroup --name mycontainer --image mcr.microsoft.com/azuredocs/aci-helloworld --cpu 1 --memory 1 --restart-policy Never
This command creates and runs a container instance with 1 CPU and 1 GB memory, using a simple hello world image.
Process Table
StepActionInput/ConfigResult/State
1Create container groupResource group: myGroup, Name: mycontainerContainer group created, ready to deploy
2Specify container imageImage: mcr.microsoft.com/azuredocs/aci-helloworldImage set for container
3Set CPU and memoryCPU: 1, Memory: 1 GBResources allocated
4Set restart policyRestart policy: NeverContainer will not restart after exit
5Deploy container instanceRun deployment commandContainer instance starts running
6Container runsContainer executes hello world appContainer status: Running
7Container completesApp finishes executionContainer status: Terminated
8View logsaz container logs --resource-group myGroup --name mycontainerOutput: Hello from Azure Container Instances!
9Delete containeraz container delete --resource-group myGroup --name mycontainerContainer instance deleted
💡 Container completes execution and is deleted to free resources
Status Tracker
VariableStartAfter Step 2After Step 3After Step 5After Step 7Final
Container GroupNoneCreatedCreatedRunningTerminatedDeleted
Container ImageNoneSet to hello world imageSetSetSetSet
CPUNoneNone1 CPU1 CPU1 CPUNone
MemoryNoneNone1 GB1 GB1 GBNone
Restart PolicyNoneNoneNeverNeverNeverNone
Container StatusNoneNoneNoneRunningTerminatedDeleted
Key Moments - 3 Insights
Why does the container stop running after the app finishes?
Because the restart policy is set to 'Never', the container stops once the app completes, as shown in step 7 of the execution table.
What happens if you don't delete the container instance after it finishes?
The container instance remains in the terminated state and continues to consume resources and cost until deleted, so step 9 is important.
How do you see what the container printed during its run?
You use the 'az container logs' command as in step 8 to view the container's output logs.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the container status immediately after deployment (step 5)?
ADeleted
BTerminated
CRunning
DCreated
💡 Hint
Check the 'Result/State' column at step 5 in the execution table.
At which step does the container stop running?
AStep 7
BStep 6
CStep 8
DStep 9
💡 Hint
Look for when the container status changes to 'Terminated' in the execution table.
If you change the restart policy to 'Always', what would change in the execution table?
AContainer would never start running
BContainer status would stay 'Running' after step 7
CContainer would be deleted automatically
DLogs would not be available
💡 Hint
Consider how restart policy affects container status after app completion.
Concept Snapshot
Azure Container Instances (ACI) let you run containers easily without managing servers.
Use 'az container create' with image, CPU, memory, and restart policy.
Container runs until app finishes or restart policy triggers.
View logs with 'az container logs'.
Delete container to free resources.
Full Transcript
This visual execution shows how to run a simple container in Azure Container Instances (ACI). First, you create a container group and specify the container image. Then you set CPU and memory resources and choose a restart policy. Deploying the container starts it running. The container runs the app and then stops if the restart policy is 'Never'. You can view the container's output logs and finally delete the container instance to free resources. Key points include understanding the restart policy effect and the importance of deleting containers after use.