How to restart an individual azure container

Reuben Cummings 50 Reputation points
2024-06-17T14:53:26.59+00:00

az container restart restarts "all containers in a container group". Since this can cause downtime, how do I only restart an individual container instance? I currently use the Python SDK in an Azure Function to run ContainerInstanceManagementClient.container_groups.begin_restart.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
662 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,499 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dan Rios 1,580 Reputation points MVP
    2024-06-17T15:02:18.0333333+00:00

    Hi there,

    You can't restart a specific container in a container group, unfortunately: https://learn.microsoft.com/en-us/azure/container-instances/container-instances-update?#limitations

    All containers in a container group are restarted when you update the container group. You can't perform an update or in-place restart of a specific container in a multi-container group.

    You may want to explore an alternative service like Azure Container Apps which can use a revision to bring up with no downtime to the service.


  2. Reuben Cummings 50 Reputation points
    2024-06-18T14:52:06.8133333+00:00

    Thanks Dan. The work-a-round I plan to going with is using az container exec. I haven't tried it yet, but I'm hoping the arguments issue has been solved.