azurevisual-studioasp.net-coreazure-container-registry

Visual Studio failed to publish to Azure Container Registry


I have an ASP.NET Core application that I am trying to migrate to Azure. I am using Azure Container Registry to publish my app's images and run it on Container App. Until a few days ago, I was able to successfully push the image to the container registry using Visual Studio's 'Publish Tool'. However, recently, the publication has stopped working: I always get a message saying the publication was successful, but I can't find any published image.

I increased the log level in Visual Studio and consistently see the following error:

CONTAINER1013: Failed to push to the output registry: CONTAINER1008: Failed retrieving credentials for "containerregistryname.azurecr.io": Docker config file doesn't exist.

Unfortunately, for various reasons, I cannot use Docker Desktop on my machine, so I was relying on Visual Studio for publishing. I also checked the logs on Azure Container Registry, but there is nothing related to these failed publication attempts.Thank you.


Solution

  • I created sample Asp.net core Application and published to Azure Container Registry using Visual Studio without Docker desktop I got the error.

    There is an alternative method to push the image to Azure Container Registry using Azure CLI.

    Open Command Prompt Run the az login command and follow the Authentication process.

    By running the below command, you will get an access token:

    az acr login --name <ACRName> --expose-token
    

    After obtaining the access token, run the below command to build and push the image to Azure Container Registry.

    az acr build --registry <ACRName>.azurecr.io --image webapp6:latest --file path/to/Dockerfile path/to/project.
    

    I was successfully pushed my image to ACR without Docker Desktop.

    enter image description here

    Below is my image:

    enter image description here