You need to host an event-processing worker in Azure Container Instances (ACI). The worker continuously monitors an external queue. The workload must meet the following configuration requirements:
- The container must run continuously under normal operation.
- If the container process terminates with a non-zero exit code due to an unhandled error, it must be restarted automatically.
- If a maintenance script gracefully terminates the container process (exit code 0), the container must remain terminated.
Which restart policy configuration should you apply to the container group?
- AConfigure the container group restart policy to Always.
- BConfigure the restart policy to OnFailure for the event-processing container and Never for the container group.
- Configure the container group restart policy to OnFailure.Answer
- DConfigure the container group restart policy to Never.
Answer
Configure the container group restart policy to OnFailure.
The correct configuration is to set the container group's restart policy to OnFailure. Under this policy, Azure Container Instances (ACI) will automatically restart the container if the containerized process terminates with a non-zero exit code (indicating a failure). If the process terminates with exit code 0 (indicating success or a graceful shutdown), the container group transitions to a Succeeded state and is not restarted. This matches all specified requirements.
Step-by-Step Solution
Key Concept
Azure Container Instances restart policies are configured at the container group level and evaluate exit codes to determine restart behavior.