Docker Community Forums

Share and learn in the Docker community.

Docker File for .Net 4.6 Framework and .Net Core CLI


(Simontan) #1

I am trying to dockerize my Web API application. Basically, the project is a Console application with target framework .net 4.6.1. Below is my dockerfile and it is failing at dotnet restore. What are the things I need to change on my DockerFile?

DockerFile
FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base
WORKDIR /app
EXPOSE 3000

FROM microsoft/dotnet-framework-build:4.7.1 AS build
WORKDIR /src

COPY *.csproj ./
RUN dotnet restore
COPY . .
WORKDIR /src
RUN dir /src
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
RUN dir
ENTRYPOINT [“service.exe”]

Output
Sending build context to Docker daemon 96.4MB
Step 1/18 : FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base
—> a4f259a87d18
Step 2/18 : WORKDIR /app
—> Using cache
—> f6ffe438b735
Step 3/18 : EXPOSE 3000
—> Using cache
—> e1bad3546f63
Step 4/18 : FROM microsoft/dotnet-framework-build:4.7.1 AS build
—> b7889c0b8310
Step 5/18 : WORKDIR /src
—> Using cache
—> 38375088de3d
Step 6/18 : COPY *.csproj ./
—> Using cache
—> 4db609eb2433
Step 7/18 : RUN dotnet restore
—> Running in 03f1a03e86e2
Restoring packages for C:\src\labelservice2.csproj…
Restoring packages for C:\src\labelservice2.csproj…
Restore completed in 1.35 min for C:\src\labelservice2.csproj.
re-exec error: exit status 1: output: time=“2018-01-23T08:54:39-05:00” level=error msg="hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\\?\C:\ProgramData\Docker\windowsfilter\8d424686d911caf25ba48d565903a9eaa850f2982b01905ace02f99de8380454 flavour=1 folder=C:\ProgramData\Docker\tmp\hcs925529259"
hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3) layerId=\?\C:\ProgramData\Docker\windowsfilter\8d424686d911caf25ba48d565903a9eaa850f2982b01905ace02f99de8380454 flavour=1 folder=C:\ProgramData\Docker\tmp\hcs925529259PS C:\fuji\branches\dev\WebServices\labelservice2\labelservice2> 23525221601235252216012352522160123525221601235252216012352522160123525221601