DEV Community

loading...

Fix: Azure DevOps “An image does not exist locally with the tag”

seankilleen profile image Sean Killeen Originally published at seankilleen.com on ・1 min read

I was working on a livestream recently when I ran into an issue attempting to push a docker container to a private registry in Azure DevOps.

Problem

Upon attempting to push the container to my container registry, I received the error:

[error]An image does not exist locally with the tag: ***/konmaripoweb

This is weird, because this tag should be happening automatically. Something wasn’t matching up.

Solution

The fix in this case actually has to do with how the Azure DevOps tasks work, in particular the Docker@2 task that I was working with.

I pulled the repo and looked into the DockerV2 task’s source code to find the solution.

I noticed that in the build and publish tasks specify a registry name if the containerRegistry value is set or the service connection exists. My publish step was specifying this attribute, but my build step was not.

I modified the build step to also pass in this parameter, and the correct tags were created across both steps to resolve the issue.

Happy (containerized) coding!

Discussion

pic
Editor guide
Collapse
shashankkr profile image
Shashank Kumar

Hi Sean,
I am also having the same problem except - I am pulling the image from one container registry and pushing it to another. Pull works fine but the push fails with the same error. Can you provide some screenshots for your build and release? Thanks for the help.

Collapse
mukiblejlok profile image
FMu

Thanks for that! You saved me some hours of debugging.

Collapse
michaelmasas profile image
Michael Masas

Thank You !