Question

Difficulty: MediumConfigure Azure Container Instances (ACI)

You are deploying a containerized application to Azure Container Instances (ACI) that hosts an API listener. The application must run continuously. If the application process exits with an exit code of 0 (successful termination) after completing an internal self-update, the container must be restarted automatically to resume listening for requests. Which restart policy should you configure for the container group?

  1. AlwaysAnswer
  2. B
    OnFailure
  3. C
    Never
  4. D
    OnSuccess

Answer

Always
The correct answer is Always because the workload requires a continuous running state. In Azure Container Instances, the Always restart policy guarantees that containers in the group are restarted regardless of their exit status (0 or non-zero). Since the listener container exits with code 0 after self-updating, the Always policy ensures that it is restarted to continue processing requests.

Step-by-Step Solution

1
Analyze the workload requirements.
The workload is a continuous API listener that must stay online indefinitely.
Understanding the lifecycle of the container helps determine the correct container restart behavior.
2
Evaluate the exit condition.
The application exits with code 0 (success) during self-update operations.
Knowing that the process exits with code 0 is critical because it rules out policies that only react to non-zero exit codes.
3
Match the requirement with the correct restart policy.
Select the Always restart policy.
Only the Always policy restarts the container group when a process completes successfully with exit code 0.

Key Concept

Azure Container Instances restart policies determine how ACI manages the lifecycle of containers in a group based on their exit codes. For long-running or continuous services, the Always policy is used to guarantee that the containers are restarted after any termination, including successful exits.
Estimated Time:1m 30s
Rate this question