【发布时间】:2019-03-05 08:04:27
【问题描述】:
我正在尝试使用 Visual Studio 2017 将我的 .NET Core 项目发布到 Docker Hub。
接下来,我选择 Docker Hub 并在下一步中输入我的凭据。
此项目已成功构建,但未能发布。 这是我的输出。
docker build -t "netcore" -f "Dockerfile" --label "com.microsoft.created-by=visual-studio" ".."
Sending build context to Docker daemon 3.936MB
Step 1/19 : FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803 AS base
2.2-aspnetcore-runtime-nanoserver-1803: Pulling from microsoft/dotnet
e46172273a4e: Pulling fs layer
68aae72b77f3: Pulling fs layer
61f30f9e4e83: Pulling fs layer
e15c123b212e: Pulling fs layer
021eb2251d67: Pulling fs layer
dc7ca004e96c: Pulling fs layer
ecedf99e17d3: Pulling fs layer
e15c123b212e: Waiting
021eb2251d67: Waiting
dc7ca004e96c: Waiting
ecedf99e17d3: Waiting
image operating system "windows" cannot be used on this platform
C:\Users\kelvin\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.0.2105168\build\Container.targets(159,5):
Error MSB3073: The command "docker build -t "netcore" -f "Dockerfile" --label "com.microsoft.created-by=visual-studio" ".."" exited with code 1.
2>Build failed. Check the Output window for more details.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
请问有人有解决办法吗?
【问题讨论】:
-
"镜像操作系统windows不能在这个平台上使用":你的docker安装是否设置为运行windows容器?默认是我没记错的linux容器
-
@D.J.我认为是的,因为这只是我第一次使用 Docker。你能告诉我更多关于你的答案的细节吗?
-
你必须明确设置你的 docker 来运行 windows。查看docs.microsoft.com/en-us/virtualization/windowscontainers/… 以获取有关如何检查和设置此设置的说明
-
好的。检查它,稍后会回到这里
-
@D.J.我发现自己在创建 VSProject 时选择了错误的操作系统。非常感谢您的信息提醒我的错误。
标签: .net docker asp.net-core .net-core