I am getting error while i push image through azure pipeline
##[error]An image does not exist locally with the tag: icndpaksacr.azurecr.io/autopipe
I am using the following deployment file
name: test run
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-abc'
azureContainerRegistry:
loginServer: acr.azurecr.io
id: "/subscriptions/4f76bb2f-c521-45d1-b311-xxxxxxxxxx/resourceGroups/eus-abc-rg/providers/Microsoft.ContainerRegistry/registries/acr"
imageName: acr.azurecr.io/ims-abc/$(Build.Repository.Name):$(Build.BuildId)
- task: Docker@0
displayName: Push an image
inputs:
azureSubscription: 'sc-abc'
azureContainerRegistry: '{"loginServer":"acr.azurecr.io", "id" : "/subscriptions/4f76bb2f-c521-45d1-b311-xxxxxxxxxx/resourceGroups/eus-icndp-rg/providers/Microsoft.ContainerRegistry/registries/acr"}'
action: Push an image
As it says image is not exists in registry, however, i am creating image dynamically $(Build.Repository.Name):$(Build.BuildId) , it will not possible to keep the image in repository upfront, how to go about this?
CodePudding user response:
You can confirm the images before Docker push with a new task:
- script: docker image ls
.
And Suggest to use latest Docker@2
task instead of Docker@0
.
Before you push the image, make sure you have authenticated, you can add below task:
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: dockerRegistryServiceConnection1