官术网_书友最值得收藏!

Creating Azure Container Registry

Azure Container Registry (ACR) is a fully managed private Docker registry provided by Azure Cloud. In this section, we will create a new instance of ACR using the Azure CLI. You will learn how to achieve similar build automation as provided by Docker Hub but with the possibility of building Windows images and using a private registry.

You can find detailed installation instructions for the Azure CLI in  Chapter 2 , Managing State in Containers .

To create an Azure Container Registry instance, follow these steps:

  1. Ensure that you are logged in to the Azure CLI by using the az login command in PowerShell. Proceed by creating a dedicated resource group for your ACR instance. In this example, we will use the acr-resource-group resource group and westeurope as the Azure location:
az group create `
--name acr-resource-group `
--location westeurope
You can also use the PowerShell script available in this book's GitHub repository:  https://github.com/PacktPublishing/Hands-On-Kubernetes-on-Windows/blob/master/Chapter03/03_CreateAzureContainerRegistry.ps1. Remember to provide a globally unique ACR name in order to be able to create the instance.
  1. Next, create a basic-tier ACR instance with a globally unique name (for demonstration purposes, we have provided handsonkubernetesonwinregistry, but you have to provide your own unique name as it will be a part of the registry's DNS name):
az acr create `
--resource-group
acr-resource-group `
--name handsonkubernetesonwinregistry `
--sku
Basic
If you are interested in other service tiers of Azure Container Registry, please refer to the official documentation:  https://docs.microsoft.com/en-us/azure/container-registry/container-registry-skus.

You will be provided with detailed information regarding your newly created registry:

{
"adminUserEnabled": false,
"creationDate": "2019-08-18T21:20:53.081364+00:00",
"id": "/subscriptions/cc9a8166-829e-401e-a004-76d1e3733b8e/resourceGroups/acr-resource-group/providers/Microsoft.ContainerRegistry/registries/handsonkubernetesonwinregistry",
"location": "westeurope",
"loginServer": "handsonkubernetesonwinregistry.azurecr.io",
"name": "handsonkubernetesonwinregistry",
"networkRuleSet": null,
"provisioningState": "Succeeded",
"resourceGroup": "acr-resource-group",
"sku": {
"name": "Basic",
"tier": "Basic"
},
"status": null,
"storageAccount": null,
"tags": {},
"type": "Microsoft.ContainerRegistry/registries"
}

The most important information is "loginServer": "handsonkubernetesonwinregistry.azurecr.io", which will be used for pushing and pulling Docker images.

  1. Finally, the last step is to log in to the registry so that you can use the registry in the Docker CLI:
az acr login `
--name handsonkubernetesonwinregistry

With ACR set up, we are ready to build a Docker image using ACR in the cloud environment.

主站蜘蛛池模板: 滁州市| 西乌珠穆沁旗| 榕江县| 新营市| 松潘县| 东港市| 行唐县| 浦县| 诏安县| 洛南县| 肥西县| 嘉鱼县| 阿尔山市| 福建省| 麻城市| 洪雅县| 蒙自县| 平罗县| 牟定县| 阿图什市| 道真| 关岭| 恭城| 石河子市| 日土县| 江达县| 武功县| 广水市| 锦屏县| 平塘县| 南康市| 石林| 长武县| 肥西县| 达日县| 鄢陵县| 海门市| 仙游县| 马龙县| 南汇区| 马尔康县|