Deploy Azure Container Instance without starting it

inovex GmbH Beranek, Bastian 1 Reputation point
2022-11-23T13:38:18.33+00:00

Question / Feature Request: I want to deploy Azure Container Instances either from Azure CLI (az) and eventually from Terraform. After the Deployment I don't want the container to start, i.e. the deployment should happen, and I want to manually click "Start" in the Azure Portal for the container to actually run. At the moment the container will automatically start running after the deployment. In our case this is important because the running the Container Image has destructive consequences for particular data and we don't want this to happen "accidentally".

This seems to be impossible at the moment, am I right?

az container create \
--resource-group myResourceGroup \
--name mycontainer \
--image mycontainerimage \
--stopped <- MY INVENTION (does not exist at the moment)

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
645 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. shiva patpi 13,141 Reputation points Microsoft Employee
    2022-11-23T13:53:49.75+00:00

    Hello @inovex GmbH Beranek, Bastian ,
    Right now, that's not a possible option . I was thinking how about if you use the concept of initContainers where you can do whatever the pre-requisites needed before your actual container runs ?

    Or while deploying the ACI , you can have a command line , in that commandline you can delay/sleep whatever the amount of time .

    "command": [
    "/bin/sh",
    "-c",
    "sleep 60; echo 'waiting...'"
    ]

    Please see below ARM template if that helps ?

    https://learn.microsoft.com/en-us/azure/container-instances/container-instances-init-container?source=recommendations

    0 comments No comments

  2. inovex GmbH Beranek, Bastian 1 Reputation point
    2022-11-23T14:00:27.003+00:00

    Hello, thanks for the answer and for the pointers for the possible workarounds.

    Would it be possible to consider adding this option as a feature request?


  3. Rob Smith 0 Reputation points
    2024-01-30T12:50:22.6033333+00:00

    Yep, this would be useful for us as well. Right now to control this we deploy a setting to App Configuration (or other database) and enabled : true/false. The worker service checks against this and exits immediately if false. That way we can control the container operation without redeploying and therefore delay the critical part of the worker service operation until we are ready.

    0 comments No comments

  4. Toby 0 Reputation points
    2024-02-20T15:25:29.8733333+00:00

    We use ACI mostly for processes that require more time/cpu/memory than is reasonable for function apps, but not so much that they would justify a dedicated VM (such as processing batch files from vendors and business partners.) We start the ACI from a timer-triggered function app, it typically runs for seconds (if there's nothing to process) to minutes (if there is something to process) and exits/terminates. We do NOT want or need these to run during our IaC deployments.

    0 comments No comments