Soru

Zorluk: KolayRun Containerized Solutions using Azure Container Instances

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?

  1. OnFailureCevap
  2. B
    Always
  3. C
    Never
  4. D
    OnSuccess

Cevap

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.

Adım Adım Çözüm

1
Analyze the requirements for container execution and lifecycle behavior.
The container needs to run a task to completion, retry if it fails (non-zero exit code), and remain stopped if it succeeds (zero exit code).
This establishes the logical trigger conditions for restarting the container.
2
Evaluate the supported restart policies in Azure Container Instances (ACI).
ACI supports three restart policies: Always, Never, and OnFailure.
Knowing the valid options eliminates unsupported configurations like OnSuccess.
3
Match the required restart trigger conditions with the correct policy.
The OnFailure policy matches the need to retry only on failure and stop on success.
Selecting OnFailure fulfills the scenario requirements while preventing unnecessary resource billing.

Anahtar Kavram

Azure Container Instances restart policies determine how containers inside a container group are restarted after their processes terminate.
Bu soruyu puanla