Soru

Zorluk: OrtaConfigure Azure Container Instances (ACI)

You plan to deploy a containerized application to Azure Container Instances (ACI). The application is a script that processes transaction logs from an Azure Storage queue, writes the results to an Azure SQL database, and then exits. If the script exits with an error code, it must automatically restart to retry the process. If the script exits successfully, the container must stop and not restart. Which restart policy should you configure for the container group?

  1. A
    Always
  2. B
    Never
  3. OnFailureCevap
  4. D
    UnlessStopped

Cevap

OnFailure
The correct answer is OnFailure because it ensures that the container will restart only if it exits with an error code (non-zero). If it exits successfully (exit code 0), it remains stopped, matching the scenario requirements.

Adım Adım Çözüm

1
Analyze the workload requirements.
The workload is a batch-like script that runs to completion, exits with code 0 upon success, and should retry (restart) only if it fails (exits with a non-zero code).
Understanding the desired container lifecycle is necessary to select the correct policy.
2
Evaluate the supported Azure Container Instances (ACI) restart policies.
ACI supports three restart policies: Always, Never, and OnFailure.
This filters out unsupported Docker-specific restart policies like UnlessStopped.
3
Select the policy that matches the required behavior.
The OnFailure policy restarts the container group only when the container processes terminate with a non-zero exit code. Always restarts the container regardless of the exit code, and Never never restarts the container. Therefore, OnFailure is the correct choice.
Applying the correct lifecycle configuration prevents continuous loop execution of successful tasks or failure to retry transient errors.

Anahtar Kavram

Azure Container Instances Restart Policies
Tahmini Süre:1m 30s
Bu soruyu puanla