Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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()

===================
like image 289
Saurabh Kulkarni Avatar asked Jul 01 '21 10:07

Saurabh Kulkarni


People also ask

How do I publish a Docker image to Docker Hub?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).

Can you Containerize .NET application?

NET Framework application must run on Windows, period. If you want to containerize existing . NET Framework applications and you can't or don't want to invest in a migration to . NET Core or later("If it works properly, don't migrate it"), the only choice you have for containers is to use Windows Containers.


2 Answers

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"

like image 95
Jorge Aguilar Avatar answered Oct 19 '22 20:10

Jorge Aguilar


I had the same issue and I was was able to resolve by switching the docker context back to default (it was set to desktop-linux) using the command:

docker context use default
like image 21
Chris Avatar answered Oct 19 '22 20:10

Chris