Search code examples
azuredockerasp.net-coredockerhub

Error in Publishing .Net Core Web App on Docker Hub


I am learning docker and containers. I am trying to Publish my .Net Core 3.1 Web App on Docker Hub via visual studio 2019. I am on Windows PC, But the visual studio deployment environment is set to Linux and Docker also set to Linux. I have installed WSL2 (Windows subsystem for linux 2) as well. Also the Web app is executing well and at the same time I can see the container and image is created into Docker dashboard (running) successfully. However, while trying to publish it on Docker Hub, I am getting below error.

Can you help me out that which part is missing on my PC (it is azure windows 10 VM)?

Note: I am able to run linux containers as well without any issue. Also Ubuntu 20 is installed from Windows Shop.

2021-07-01 10:19:58 AM
Microsoft.WebTools.Azure.Publish.Docker.DockerCommandException: Running the docker.exe tag command failed.

Current context "desktop-linux" is not found on the file system, please check your config file at C:\Users\kulkarnis009\AppData\Local\Temp\7961a412d485473395194d8ad39fe785\config.json
   at Microsoft.WebTools.Azure.Publish.Docker.DockerOperations.ThrowDockerCommandError(String dockerCommand)
   at Microsoft.WebTools.Azure.Publish.Docker.DockerOperations.<DockerTagAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.Publish.Docker.DockerPublish.<DockerPublishAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.Publish.ContainerRegistry.ManageContainerRegistry.<PushImageAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.WebTools.Azure.Publish.PublishProviders.ContainerRegistryProfileVisual.<PostPublishAsync>d__38.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Publish.Framework.Nexus.PublishProfilesServiceImpl.ServerProjectProfilesManager.<RunPublishTaskAsync>d__53.MoveNext()

===================

Solution

  • in the file

    file:///C:/Users/UserName/AppData/Local/Temp/c69e796a148440f18675b80111e06796/config.json
    

    Change desktop-linux

    {
      "auths": {},
      "credsStore": "desktop",
      "currentContext": "default",
      "stackOrchestrator": "swarm",
      "HttpHeaders": {
        "X-Meta-Source-Client": "vs/web/publish"
      }
    }
    

    currentContext had desktop-linux, I just put "default"