Azure Container Registry and Container Instances · AZ-204: Developing Solutions for Microsoft Azure Develop Azure Compute Solutions

A batch workload runs in Azure Container Instances and should stop after completing successfully. If it fails, Azure should restart the container aut…

Practice question from Azure Container Registry and Container Instances (AZ-204: Developing Solutions for Microsoft Azure Develop Azure Compute Solutions), with the correct answer and a step-by-step solution.

easy · MCQ · Q-2F075C

A batch workload runs in Azure Container Instances and should stop after completing successfully. If it fails, Azure should restart the container automatically. Which Azure CLI option provides this behavior?

  1. A.az container create --resource-group rg1 --name batch1 --image contoso/batch:1.0 --restart-policy Always
  2. B.az container create --resource-group rg1 --name batch1 --image contoso/batch:1.0 --restart-policy OnFailureCorrect answer
  3. C.az container create --resource-group rg1 --name batch1 --image contoso/batch:1.0 --restart-policy Never
  4. D.az container create --resource-group rg1 --name batch1 --image contoso/batch:1.0 --restart-policy Manual

Solution

The OnFailure restart policy restarts the container when its process exits with a failure, but does not restart it after a successful completion. Always is intended for continuously running workloads, while Never disables automatic restarts.

More from Azure Container Registry and Container Instances

All of Azure Container Registry and Container Instances

Practise more Develop Azure Compute Solutions

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed