You are deploying a container to Azure Container Instances (ACI) to run a data validation task. The task must run to completion. If the validation script fails with a non-zero exit code, the container must automatically restart to retry the task. If the script succeeds (zero exit code), the container must stop and not restart. Which restart policy should you apply to the container group?
- OnFailureAnswer
- BAlways
- CNever
- DOnSuccess
Answer
The correct policy is OnFailure.
The restart policy configured as 'OnFailure' is correct because it restarts the container only when the process exits with a non-zero exit code, allowing the container to retry the validation task if it fails, while remaining stopped when the task succeeds.
Step-by-Step Solution
Key Concept
Azure Container Instances restart policies determine how containers inside a container group are restarted after their processes terminate.