Skip to content

Latest commit

 

History

History
43 lines (41 loc) · 2.03 KB

10.1. Azure Container Registry.md

File metadata and controls

43 lines (41 loc) · 2.03 KB

Azure Container Registry

  • Managed private Docker registry service
  • Store your private Docker container images
  • Security (❗ below features are only available in Premium SKU)
    • Consent trust for image tag signing
    • Firewalls and virtual networks to restrict access to the registry.
  • If you want your CI/CD tool to be able to work with ACR =>
    • Create a service principal e.g. for Jenkins.
      • az ad sp create-for-rbac --skip-assignment
    • Assign it to the ACR:
      • az role assignment create --assignee 626dd8ea-042d-4043-a8df-4ef56273670f --role Contributor --scope $ACR_ID
    • You can now use appId (username) and password of your service principal to push & update images.
  • To upload image
    • Install azure CLI: apt-get azure-cli
    • Sign in: az login
    • Create a container registry: az acr create --resource-group registry-rg --name registry --sku Standard --location eastus
    • Build image & tag & push it to Azure
      • Using CLI:
        • az acr build --registry registry --image namewithtag:v1 .
      • Using Azure Pipelines:
        • You can create a new pipeline & configure it to be docker, it'll then create azure-pipelines.yml file.

        • Or you can create the yaml file yourself using Docker task:

          - stage: Build
            displayName: Build and push stage
            jobs:  
            - job: Build
              displayName: Build job
              pool:
                vmImage: $(vmImageName)
              steps:
              - task: Docker@2
                displayName: Build and push an image to container registry
                inputs:
                  command: buildAndPush
                  repository: $(imageRepository)
                  dockerfile: $(dockerfilePath)
                  containerRegistry: $(dockerRegistryServiceConnection)
                  tags: |
                    $(tag)