#Azure CLI version 2.0.27 or later #https://docs.microsoft.com/ru-ru/azure/container-registry/container-registry-get-started-azure-cli #$resource_group_name = "IoTEdgeResources" $resource_group_name = "RemoteMonitoringTest1018" $ContainerRegistryName = "RemoteMonitoringContainterRegistry1018" $ContainerName = "acr-quickstart" $dns_name_label = "shneider" #Create a resource group named myResourceGroup in the eastus location. az group create --name $resource_group_name --location westeurope #create a Basic registry. Azure Container Registry is available in several different SKUs: Basic, Standard, Premium. #The registry name must be unique within Azure, and contain 5-50 alphanumeric characters. #After finishing the command - new resource will be available in Azure "All resources". az acr create --resource-group $resource_group_name --name $ContainerRegistryName --sku Basic #Before pushing and pulling container images, you must log in to the ACR instance. To do so, use the az acr login command. #The result can be "This command requires running the docker daemon, which is not supported in Azure Cloud Shell." #Just ignore and go the next steps az acr login --name $ContainerRegistryName #To push an image to an Azure Container registry, you must first have an image. If you don't yet have any local container images, #run the following command to pull test image "aci-helloworld" from Docker Hub. #Run the command on the developer PC where Docker was installed. #docker pull microsoft/aci-helloworld #Before you can push an image to your registry, you must tag it with the fully qualified name of your ACR login server. #Run the following command to obtain the full login server name of the ACR instance. az acr list --resource-group $resource_group_name --query "[].{acrLoginServer:loginServer}" --output table #Tag the image using the docker tag command. Replace with the login server name of your ACR instance. #Run the command on the developer PC where Docker was installed. #docker tag microsoft/aci-helloworld /aci-helloworld:v1 #Login to your container registry #In Azure go to: "All resources" -> -> "Access keys" #Switch "Admin user" to "Enable" to get the username and password. #You can do this operations by commands: az acr update --name --admin-enabled true az acr credential show --name $ContainerRegistryName --query "passwords[0].value" #Run the command on the developer PC where Docker was installed. #docker login --username $ContainerRegistryName --password #Use docker push to push the image to the ACR instance. Replace with the login server name of your ACR instance. #Run the command on the developer PC where Docker was installed. #docker push /aci-helloworld:v1 #The following command lists the repositories in a registry. az acr repository list --name $ContainerRegistryName --output table #The following example lists the tags on the aci-helloworld repository. #aci-helloworld should be replaced for the result of the previous command az acr repository show-tags --name $ContainerRegistryName --repository aci-helloworld --output table #To deploy your container image with 1 CPU core and 1 GB of memory, run the following command. #Replace , , and with the values you obtained from previous commands. #https://docs.microsoft.com/en-us/cli/azure/container?view=azure-cli-latest#az-container-create #Example: #az container create --resource-group $resource_group_name --name $ContainerName --image remotemonitoringcontainterregistry1018.azurecr.io/aci-helloworld:v1 --cpu 1 --memory 1 --registry-username $ContainerRegistryName --registry-password wQQogP5DLV7q8=5r60YQx8lnKrSDo54D --dns-name-label $dns_name_label --ports 80 az container create --resource-group $resource_group_name --name $ContainerName --image /aci-helloworld:v1 --cpu 1 --memory 1 --registry-username $ContainerRegistryName --registry-password --dns-name-label $dns_name_label --ports 80 #Once the deployment to ACI is successful, retrieve the container's FQDN with the az container show command: az container show --resource-group $resource_group_name --name $ContainerName --query ipAddress.fqdn #Clean up resources #When no longer needed, you can use the az group delete command to remove the resource group, ACR instance, and all container images. #!!!!! WARNING !!!!! #az group delete --name $resource_group_name