create_aci function

Create Azure Container Instance (ACI)

Create Azure Container Instance (ACI)

Method for the AzureRMR::az_resource_group class.

Usage

create_aci(name, location = self$location,
      container = name, image,
      registry_creds = list(),
      cores = 1, memory = 8,
      os = c("Linux", "Windows"),
      command = list(), env_vars = list(),
      ports = aci_ports(), dns_name = name, public_ip = TRUE,
      restart = c("Always", "OnFailure", "Never"), managed_identity = TRUE,
      ...)

Arguments

  • name: The name of the ACI service.
  • location: The location/region in which to create the ACI service. Defaults to this resource group's location.
  • container: The name of the running container.
  • image: The name of the image to run.
  • registry_creds: Docker registry authentication credentials, if the image is stored in a private registry. See 'Details'.
  • cores: The number of CPU cores for the instance.
  • memory: The memory size in GB for the instance.
  • os: The operating system to run in the instance.
  • command: A list of commands to run in the instance. This is similar to the --entrypoint commandline argument to docker run; see here for some examples.
  • env_vars: A list of name-value pairs to set as environment variables in the instance.
  • secure_env_vars: A list of name-value pairs to set as secure environment variables in the instance. The values of these variables are not visible in the container's properties, eg when viewed in the Azure portal or via the CLI.
  • ports: The network ports to open. By default, opens ports 80 and 443. See 'Details'.
  • dns_name: The domain name prefix for the instance. Only takes effect if public_ip=TRUE.
  • public_ip: Whether the instance should be publicly accessible.
  • restart: Whether to restart the instance should an event occur.
  • managed_identity: Whether to assign the container instance a managed identity.
  • ...: Other named arguments to pass to the az_resource initialization function.

Details

An ACI resource is a running container hosted in Azure. See the documentation for the resource for more information. Currently ACI only supports a single image in an instance.

To supply the registry authentication credentials, the registry_creds argument should contain either an ACR object, a docker_registry object, or the result of a call to the aci_creds function.

The ports to open should be obtained by calling the aci_ports function. This takes a vector of port numbers as well as the protocol (TCP or UDP) for each port.

Value

An object of class az_container_instance representing the instance.

Examples

## Not run: rg <- AzureRMR::get_azure_login()$ get_subscription("subscription_id")$ get_resource_group("rgname") # get the ACR resource that contains the image myacr <- rg$get_acr("myregistry", as_admin=TRUE) rg$create_aci("mycontainer", image="myregistry.azurecr.io/myimage:latest", registry_creds=myacr) ## End(Not run)

See Also

get_aci , delete_aci , list_acis

az_container_instance

ACI documentation and API reference

Docker commandline reference

  • Maintainer: Hong Ooi
  • License: MIT + file LICENSE
  • Last published: 2021-07-09