.NET到Docker Hub的构建成功但发布失败

时间:2019-03-05 08:04:28

标签: .net docker asp.net-core .net-core

我正在尝试使用Visual Studio 2017将我的.NET Core项目发布到Docker Hub。

Right click for Publish

下一步,我选择Docker Hub,然后在下一步中输入我的凭据。

enter image description here

该项目已成功构建,但无法发布。 这是我的输出。

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 ==========

请问有人对此有解决方案吗?

1 个答案:

答案 0 :(得分:1)

使用Docker Toolbox时,在创建VSProject时必须选择“ Linux”。 enter image description here