You are designing a deployment plan for multiple containerized workloads in Azure Container Instances (ACI). Match each workload's execution requirements to the appropriate ACI restart policy to ensure correct container lifecycle behavior.
- An API gateway container that must run continuously to process incoming HTTP requests and restart automatically if it crashes.Always
- A scheduled data import container that runs a single batch task to completion and must restart automatically only if the task exits with an error code.OnFailure
- A one-time database migration container that executes a script to copy data and must not run again under any circumstances, even if it fails.Never
Answer
The API gateway container matches the 'Always' restart policy; the scheduled data import container matches the 'OnFailure' restart policy; and the database migration container matches the 'Never' restart policy.
The correct pairings match the workload characteristics to the standard ACI restart policies: continuous services (API gateway) map to 'Always'; tasks that run once but need a retry on errors (scheduled data import) map to 'OnFailure'; and strict single-execution tasks (database migration) map to 'Never'.
Step-by-Step Solution
Key Concept
Azure Container Instances restart policies determine the lifecycle management and automatic recovery behavior of a container group based on its workload type.