Question

Difficulty: MediumConfigure Azure Container Instances (ACI)

You are deploying a containerized application to Azure Container Instances (ACI) by using an Azure Resource Manager (ARM) template. You do not define the `restartPolicy` property in the container group definition. The application is designed to execute a one-time data synchronization script and then exit.

What will be the behavior of the container group after the application successfully completes the script and exits with an exit code of 0?

  1. The container group will continuously restart the container, resulting in repeated execution of the script.Answer
  2. B
    The container group will transition to a Succeeded state and terminate without restarting.
  3. C
    The container group will transition to a Failed state because the default policy expects a running process.
  4. D
    The container group will pause the container and remain in a Running state without consuming compute charges.

Answer

The container group will continuously restart the container, resulting in repeated execution of the script.
The correct answer is correct because Azure Container Instances defaults to the 'Always' restart policy when the `restartPolicy` configuration is omitted from the deployment definition. This policy causes the container to restart indefinitely, even after a successful exit (exit code 0), causing the synchronization script to execute repeatedly.

Step-by-Step Solution

1
Identify the default configuration behavior for ACI restart policies.
When the `restartPolicy` property is not specified in the container group definition, Azure Container Instances defaults to 'Always'.
Understanding default values is crucial for predicting ACI behavior during deployments.
2
Determine the container's lifecycle outcome based on the default policy.
Under the 'Always' policy, ACI restarts the container whenever it terminates, regardless of the exit code (0 or non-zero).
This determines how ACI responds to the successful completion of the one-time script.
3
Analyze the operational impact of this restart loop.
The container will loop through execution, termination, and restarting, running the data synchronization script repeatedly and consuming continuous compute resources.
To complete the scenario analysis and select the option describing this continuous restart behavior.

Key Concept

The default restart policy for Azure Container Instances is 'Always', which causes tasks designed to run once and exit to restart continuously if not explicitly configured with 'Never' or 'OnFailure'.
Estimated Time:1m 30s
Rate this question