How do I retrieve image URLs from Azure Container Registry?
In this guide, we will use Pulumi to create an Azure Container Registry and retrieve the image URLs from it. Azure Container Registry (ACR) is a managed Docker container registry service used for storing private Docker container images.
We will:
- Create an Azure Resource Group.
- Create an Azure Container Registry within that resource group.
- Retrieve and export the login server URL of the container registry, which can be used to construct image URLs.
Below is the Pulumi program written in TypeScript:
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure-native";
// Create an Azure Resource Group
const resourceGroup = new azure.resources.ResourceGroup("resourceGroup", {
location: "WestUS",
});
// Create an Azure Container Registry
const registry = new azure.containerregistry.Registry("myRegistry", {
resourceGroupName: resourceGroup.name,
sku: {
name: "Basic",
},
adminUserEnabled: true,
location: resourceGroup.location,
});
// Export the login server URL of the container registry
export const loginServer = registry.loginServer;
Key Points:
- Resource Group: A container that holds related resources for an Azure solution.
- Container Registry: A managed Docker container registry service used for storing private Docker container images.
- Login Server URL: The URL used to log in to the container registry, which can be combined with image names to form the full image URLs.
Summary:
We created an Azure Resource Group and an Azure Container Registry using Pulumi. We then retrieved and exported the login server URL of the container registry, which can be used to construct image URLs for the stored container images. This URL is essential for pushing and pulling images to and from the Azure Container Registry.
Deploy this code
Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.
Sign upNew to Pulumi?
Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.
Sign upThank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.