skip to Main Content

Pushing and pulling of image to Azure Container Registry task in Azure DevOps pipeline fails. When tried to pull or push from local system, there’s no problem but when tried to do it using the Azure Devops pipeline it fails. Docker login was successful but it fails when I want to pull the image from the ACR with the following result:

**Error response from daemon: Head "***/a2/abcd/manifest/latest": unauthorized: Invalid clientid or client secret. 

##[error]Bash exited with code '1'.
##[debug]Processed: ##vso[task.issue type=error;]Bash exited with code '1'. 

I checked all the service connections in Az Devops, and they all look correctly configured. Checked the associated service principals as well if they have AcrPull and AcrPush permissions, all of them are in place. Just couldn’t understand what’s going wrong.

My Yaml looks like this:

trigger: none
schedules:
- cron: "0 0 0 * *"
  displayName: ****  *
  branches:
    include:
    - abcd
  always: true

pool:
  vmImage: 'ubuntu-latest'

variables:
- name: acrname
  value: *****.azurecr.io


stages:
- stage: abcd
  displayName: "pull images from acr"
  jobs:
  - job: abcdef
    displayName: "abcdef"
    pool:
      vmImage: ubuntu-latest
    steps:
      - task: Docker@2
        displayName: Login to ACR
        inputs:
          command: login
          containerRegistry: '*****.azurecr.io'
          

      - bash: |
            docker pull $(acrname)/abc-def:latest
            docker pull $(acrname)/igh-jkl:latest
        name: pull
        displayName: 'pull acr images'

Can anyone help?

3

Answers


  1. In my case, when I ran into this issue, the simple and clean resolution was to use the docker login. In your situation, it looks like this would be a good solution :

    docker login $(acrname)
    

    prior to your calls to get your images

    docker pull $(acrname)/abc-def:latest
    
    Login or Signup to reply.
  2. In my case, the docker login password expired. So I have to do the following:

    1. Go azure and generate the new password for the docker app authentication.

    2. Copy the newly generated password.

    3. Go to your virtual machine where docker is running.

    4. Try the below command

      docker login blah.azurecr.io –username your-user-name-here –password yourhaspasswordhere~5Crf9b

    5. Now you are good to go.

    Login or Signup to reply.
    1. I had the same issue with the ACR service connection was expired. So I had to create a new service connection by using these steps.

    enter image description here

    1. Docker ID and Docker Password can be obtained from ACR –> Settings –> Access keys

    enter image description here

    1. Update your pipeline with this new service connection and you are good to go. Please rate if this solution helps you.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search