Learn R Programming

AzureContainers (version 1.0.2)

create_aci: Create Azure Container Instance (ACI)

Description

Method for the AzureRMR::az_resource_group class.

Value

An object of class az_container_instance representing the instance.

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"), ...)

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.

  • env_vars: A list of name-value pairs to set as environment variables in the instance.

  • 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.

  • wait: Whether to wait until the ACI resource provisioning is complete.

  • ...: 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.

See Also

get_aci, delete_aci, list_acis

az_container_instance

ACI documentation and API reference

Docker commandline reference

Examples

Run this code
# NOT RUN {
rg <- AzureRMR::az_rm$
    new(tenant="myaadtenant.onmicrosoft.com", app="app_id", password="password")$
    get_subscription("subscription_id")$
    get_resource_group("rgname")

# get the ACR resource that contains the image
myacr <- rg$get_acr("myregistry")

rg$create_aci("mycontainer",
    image="myregistry.azurecr.io/myimage:latest",
    registry_creds=myacr)

# }

Run the code above in your browser using DataLab