Home > Blockchain >  Unable to find the pushed image in the azure container registry
Unable to find the pushed image in the azure container registry

Time:06-09

I have pushed a new image in the azure container registry

enter image description here

But i am unable to find the image in azure container registry enter image description here

Please find the deplyment yaml file

name: Dotnet Code Build and Push
jobs:
- job: Job_1
  displayName: Agent job 1
  pool:
    vmImage: ubuntu-18.04
  steps:
  - checkout: self
  - task: Docker@0
    displayName: Build an image
    inputs:
      azureSubscription: 'sc-***dp'
      azureContainerRegistry:
      loginServer: *****aksacr.azurecr.io
      id: "/subscriptions/4f76bb2f-c521-45d1-b311-b87bf**747ff/resourceGroups/eus-***dp-rg/providers/Microsoft.ContainerRegistry/registries/*****aksacr"
      imageName: ***dpacr.azurecr.io/ims-***dp/$(Build.Repository.Name):$(Build.BuildId)
  - task: Docker@2
    displayName: Login to ACR
    inputs:
      command: login
      containerRegistry:'sc-***dp'
  - task: Docker@2
    displayName: Push an image
    inputs:
      azureSubscription: 'sc-***dp'
      repository: ims-***dp
      azureContainerRegistry: '{"loginServer":"*****aksacr.azurecr.io", "id" : "/subscriptions/4f76bb2f-c521-45d1-b311-b87bf**747ff/resourceGroups/eus-***dp-rg/providers/Microsoft.ContainerRegistry/registries/*****aksacr"}'
      action: Push an image

CodePudding user response:

I would recommend to create a new service connection with the container registry if one does not exist.

enter image description here

and select Azure Container Registry.

enter image description here

Then you can push in your registry using the below task. Keep in mind that ${{container}} should have a notation as xxx.azurecr.io/imagename:tag

 - task: Docker@2
    displayName: pushing image ${{container}} 
    inputs:
      containerRegistry: 'serviceConnectionName'
      repository: '${{container}}'
      command: 'push'
      tags: |
        mytag 

CodePudding user response:

Try to push the code in azure devops pipeline so you can directly push image in azure container registry

Here we can docker task it can build up and push the image with help of setting and it take the image from repository and then it can push into the azure container registry

 task: Docker@2
    displayName: Push an image
    inputs:
      command: buildAndpush
       repository: $(imageRepository)
       dockerfile: $(dockerfilepath)
           ContainerRegistry: $(dockerRepositoryserviceconnectio)
           tags:
               $(tag)

Save and run.

enter image description here

Note : After running you can't see Repository please refresh again because in azure pipeline the job may be still running once the job is completed & successfully run and refresh you can able see image is pushed

Please refer this document by rajaniesh kaushikk has given detail information

  • Related