1. Storing Pre-built AI Environments in Azure Container Registry


    To store pre-built AI environments in Azure Container Registry, you will need to perform a few basic steps using the azure-native package in Pulumi. This involves creating a container registry and then pushing your container images to this registry.

    Here is an overview of the steps:

    1. Creating an Azure Container Registry (ACR): This is a managed Docker registry service based on the open-source Docker Registry 2.0. An ACR provides a registry for storing, managing, and securing your container images. It integrates well with orchestrators like Azure Container Service, including Docker Swarm, DC/OS, and Kubernetes.

    2. Pushing Images to the Registry: Once you have created the ACR, you will use Docker CLI commands to push your pre-built AI environment images to the registry. This is not part of the Pulumi process but an action you perform from your command line or CI/CD process.

    Pulumi Program to Create an Azure Container Registry (ACR)

    To get started with Pulumi in Python, ensure you have Pulumi installed and configured for Azure. Below is a Pulumi program that sets up an Azure Container Registry.

    The program uses the azure-native.containerregistry.Registry resource provided by Pulumi to create a container registry. The sku parameter defines the pricing tier and size of the registry.

    import pulumi import pulumi_azure_native as azure_native # Provision a resource group to contain the ACR. This provides a namespace for your resources. resource_group = azure_native.resources.ResourceGroup("resource_group") # Create an Azure Container Registry acr = azure_native.containerregistry.Registry("my_acr", resource_group_name=resource_group.name, # The SKU determines the pricing tier and capacity of the registry. # Basic SKU is entry-level and suitable for testing or small scale usage. sku=azure_native.containerregistry.SkuArgs( name="Basic" ), # Location of your registry; typically, you'd choose the region closest to your users. location=resource_group.location, # The admin user is disabled by default; enable this if you need password-based auth. admin_user_enabled=True, ) pulumi.export('registry_name', acr.name) pulumi.export('login_server', acr.login_server)

    After running the Pulumi program, you will get the ACR's name and login server as outputs. You can then tag your pre-built AI environment images appropriately and push them to the registry using Docker CLI commands.

    Pushing Images to ACR

    The following is not executable Pulumi code, but the typical steps you'd execute in your shell to push an image to the created ACR.

    1. Log in to ACR:
    az acr login --name <ACR_NAME>
    1. Tag your local image:
    1. Push the image to ACR:
    docker push <ACR_LOGIN_SERVER>/<IMAGE_NAME>:<TAG>
    1. Verify the image is in the registry:
    az acr repository list --name <ACR_NAME> --output table

    Remember, these Docker CLI commands should be run on your local development machine or as part of a CI/CD pipeline, not within the Pulumi program.


    This program will provision a new Azure Container Registry in the cloud where you can store Docker images, including those for pre-built AI environments. You'll want to replace placeholder values such as <ACR_NAME>, <IMAGE_NAME>, and <TAG> with actual values from your specific scenario.

    Make sure that you have the necessary permissions to push images to the ACR and that your local environment is configured correctly with Docker and the Azure CLI. To manage and automate these steps as part of a larger deployment pipeline, you might also explore integrating Pulumi with your CI/CD system.