提问人:Saurabh Kulkarni 提问时间:7/1/2021 最后编辑:abduscoSaurabh Kulkarni 更新时间:7/19/2021 访问量:2303
在 Docker Hub 上发布 .Net Core Web 应用时出错
Error in Publishing .Net Core Web App on Docker Hub
问:
我正在学习 docker 和容器。我正在尝试通过 Visual Studio 2019 在 Docker Hub 上发布我的 .Net Core 3.1 Web 应用。我在 Windows PC 上,但 Visual Studio 部署环境设置为 Linux,Docker 也设置为 Linux。我也安装了 WSL2(适用于 linux 2 的 Windows 子系统)。此外,Web 应用程序执行良好,同时我可以看到容器和映像已成功创建到 Docker 仪表板(运行)中。但是,在尝试将其发布到 Docker Hub 时,我遇到了以下错误。
你能帮我解决我的电脑上缺少哪个部分(它是 azure windows 10 VM)吗?
注意:我也能够毫无问题地运行 linux 容器。此外,Ubuntu 20 是从 Windows 商店安装的。
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()
===================
答:
我遇到了同样的问题,我能够通过使用以下命令将docker上下文切换回默认值(设置为desktop-linux)来解决:
docker context use default
评论
在文件中
file:///C:/Users/UserName/AppData/Local/Temp/c69e796a148440f18675b80111e06796/config.json
更改桌面 linux
{
"auths": {},
"credsStore": "desktop",
"currentContext": "default",
"stackOrchestrator": "swarm",
"HttpHeaders": {
"X-Meta-Source-Client": "vs/web/publish"
}
}
currentContext 有 desktop-linux,我只是把“default”
评论
恢复到适用于 Windows 3.4.0 的 Docker 对我有用。
在此处下载:https://docs.docker.com/docker-for-windows/release-notes/#docker-desktop-340
下面讨论这个错误:https://github.com/docker/for-win/issues/11530 https://developercommunity.visualstudio.com/t/unable-to-publish-to-acr-running-the-dockerexe-tag/1464650 https://developercommunity.visualstudio.com/t/current-context-desktop-linux-is-not-found-on-the/1463380
评论