Dotnet build crashes with Docker

1

As I run the default from VS2017 generated Dockerfile, after a few minutes I get the following error:

The command 'cmd /S /C dotnet build "XXX.csproj" -c Release -o /app' returned a non-zero code: 4294967295: failed to shutdown container: container e9402aaef7780a5c66dca0e3b9f5683c3c2cc079ff7934844301067bd1ce07ad encountered an error during Shutdown: failure in a Windows system call: The connection with the Virtual Machine hosting the container was closed. (0xc037010a)

As I am new with Docker, I have no idee. Does anybody know, why or how can I solve it?

I am using Docker 19.03.4.

The Dockerfile:

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 ["XXX.csproj", "XXX/"]
.
.
.
COPY ["XXX.csproj", "XXX/"]
RUN dotnet restore "XXX.csproj"
COPY . .
WORKDIR "/src/XXX"
RUN dotnet build "XXX.csproj" -c Release -o /app

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

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

UPDATE: I removed all of the images (48), now works, just takes a looooooong time.

docker
.net-core
asked on Stack Overflow Nov 15, 2019 by Aaaaaaaa • edited Nov 18, 2019 by Aaaaaaaa

2 Answers

0

Looks like dotnet build is failing, it is better to build and publish binaries outside and just copy them to docker image and it reduces docker build time.

answered on Stack Overflow Nov 15, 2019 by MrKulli
0

Check the version of .net core container image

insert a little run command as shown below

FROM microsoft/dotnet:2.2-sdk-nanoserver-1803 AS build
WORKDIR /src
RUN dotnet --version
COPY ["XXX.csproj", "XXX/"]

also check the dotnet version of your local machine

dotnet --version

The two versions should match. I've ran into issues in the past where one was a preview version.

answered on Stack Overflow Nov 17, 2019 by Ziaullah Khan

User contributions licensed under CC BY-SA 3.0