Search code examples
azureazure-container-instancesazure-sdk

what are the possible values for IContainerGroup.State property? using azure sdk for container groups in azure


I am using azure SDK for management and I have the following code. I am wondering what are the possible values for IContainerGroup.State ? I am using the code below and so far i can find two values "Running" and "Succeeded" I am looking for other possible values which the documentation does not provide.

containerGroup = azure.ContainerGroups.GetByResourceGroup(rgName, aciName);
console.log($"Container State Is: { containerGroup.State }");

thanks!


Solution

  • There can be 5 possible values for containerGroup.State:

    • Running: The container group is running and will continue to try to run until a user action or a stop caused by the restart policy occurs.

    • Stopped: The container group has been stopped and will not be scheduled to run without user action.

    • Pending: The container group is waiting to initialize (finish running init containers, mount Azure file volumes if applicable). The container continues to attempt to get to the Running state unless a user action (stop/delete) happens.

    • Succeeded: The container group has run to completion successfully. Only applicable for Never and On Failure restart policies.

    • Failed: The container group failed to run to completion. Only applicable with a Never restart policy. This state indicates either an infrastructure failure (example: incorrect Azure file share credentials) or user application failure (example: application references an environment variable that does not exist).

    The following table shows what states are applicable to a container group based on the designated restart policy: enter image description here

    For more information please check here.