在Windows中构建ASP.NET Core API Docker映像失败

时间:2019-02-20 04:24:10

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

我是Docker世界的新手。我创建一个简单的ASP.NET Core API。我尝试构建Docker映像,但不会构建。

这是我的docker文件。

FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM microsoft/dotnet:2.2-sdk-nanoserver-1803 AS build
WORKDIR /src
COPY ["FirstDemo/FirstDemo.csproj", "FirstDemo/"]
RUN dotnet restore "FirstDemo/FirstDemo.csproj"
COPY . .
WORKDIR "/src/FirstDemo"
RUN dotnet build "FirstDemo.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "FirstDemo.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "FirstDemo.dll"]

这是我的错误

Step 1/17 : FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803 AS base
2.2-aspnetcore-runtime-nanoserver-1803: Pulling from microsoft/dotnet
e46172273a4e: Pull complete
68aae72b77f3: Pull complete
02db7ef764ae: Pull complete
b85c87d0746a: Pull complete
8ded5310ea16: Pull complete
50f3c06b2324: Pull complete
57b0e03264f9: Pull complete
Digest: sha256:7b0c816859dca7eeab5ae92fea96090fb37fc966622649db0567f0c752552d4a
Status: Downloaded newer image for microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803
 ---> 422d1790b708
Step 2/17 : WORKDIR /app
 ---> Running in 8ae8be6cb8c0
**re-exec error: exit status 1: output: time="2019-02-19T23:15:48-05:00" level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) path=\\\\?\\C:\\ProgramData\\Docker\\windowsfilter\\*****  folder=C:\\ProgramData\\Docker\\tmp\\hcs815654479"
hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) path=\\?\C:\ProgramData\Docker\windowsfilter\****** folder=C:\ProgramData\Docker\tmp\hcs815654479**

我也找到了这个question,但对我没有帮助。请给我建议。

1 个答案:

答案 0 :(得分:0)

对于那些可能遇到相同问题的人。

问题出在我们的安全应用程序(CHECKPOINT- ENDPOINT安全性)

它阻止Docker访问文件系统。现在,我们将其删除,然后一切正常。