I'm trying to build the most basic web Api application using VS2019 along with docker. Basically it is just the demo app provided by VS. I'm ending up with below error:
Severity Code Description Project File Line Suppression State Error CTC1014 Docker command failed with exit code 1. hcsshim::PrepareLayer - failed failed in Win32: Incorrec
Below my dockerfile
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 8080
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["RegexTesterApi/RegexTesterApi.csproj", "RegexTesterApi/"]
RUN dotnet restore "RegexTesterApi/RegexTesterApi.csproj"
COPY . .
WORKDIR "/src/RegexTesterApi"
RUN dotnet build "RegexTesterApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "RegexTesterApi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "RegexTesterApi.dll"]
Well this is the auto generated dockerfile
. But it looks pretty ok to me (also I'm new to docker).
What is actually causing the error.
I ran into the very same error (CTC1014) in the past. I found out that my project was being run in "Release" mode, when it should have been running in "Debug" mode. So I would like to suggest this as a workaround.
Here's how you change it in VS2019
Of course, running your application in Release mode shouldn't be a problem. So I assumed it must have been related to some optimization employed by most release build configurations, in conflict with Docker. Not exactly sure which one, though.
Cheers! o/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With