Docker Community Forums

Share and learn in the Docker community.

Build Image for dotNetcore 3.1

HI I am trying to create the docker image in my DotNetCoreApp 2.1 with the below docker file

#Depending on the operating system of the host machines(s) that will bu ild or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https:/ /aka.ms/containercompat

FROM
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM
WORKDIR /src
COPY [“MicroService1.csproj”, “”]
RUN dotnet restore “/MicroService1.csproj”
COPY . .
WORKDIR “/src/”
RUN dotnet build “MicroService1.csproj” -c Release -o /app

FROM build AS publish
RUN dotnet publish “MicroService1.csproj” -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT [“dotnet”, “MicroService1.dll”]

When i try to build it, it give me below error:

=> [internal] load build context 2.5s
=> => transferring context: 748.97kB 0.9s
=> [base 1/2] FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-nanoserver-1809@sha256:3cf20abfee3f21398ff34cf2d8f14fdc649123790cf945cd289aedec61c8ad58 53.0s
=> => resolve mcr.microsoft.com/dotnet/core/aspnet:2.1-nanoserver-1809@sha256:3cf20abfee3f21398ff34cf2d8f14fdc649123790cf945cd289aedec61c8ad58 0.4s
=> => sha256:3cf20abfee3f21398ff34cf2d8f14fdc649123790cf945cd289aedec61c8ad58 1.75kB / 1.75kB 0.0s
=> => sha256:877c122fd459c97829abead33a26417b17acbd922ab7afe05b07e2cec96ab5ac 2.54kB / 2.54kB 0.0s
=> => sha256:b9043d31610e0dfa43b1afe286f8918b6e3bf69ece50f44424b29d48f20aa662 101.38MB / 101.38MB 25.4s
=> => sha256:6edf5a96c5c0c6448561b857c5fd46c58138c538dab926b72171413fb62480e9 61.91MB / 61.91MB 35.8s
=> => sha256:72c59a562e3726965b1cbdb164ad24410b217a9f154fa02d779bfc1f125164ef 824B / 824B 2.6s
=> => sha256:801a77eaf0429bcd5f2f1ac3913b63e3bfa7b0c2eb6c3709d02bed3f7aa76e4f 73.19kB / 73.19kB 3.6s
=> => sha256:d4b0f3e4da98dd66e69b85ce3522f5b6c50a66cc3a8a9d98f3eb60e0b2751e22 825B / 825B 4.6s
=> => sha256:d2e6839152e3e43ff5e9ab5659ae9235b596ad9410a397d240f10760ecb18304 877B / 877B 5.4s
=> => extracting sha256:b9043d31610e0dfa43b1afe286f8918b6e3bf69ece50f44424b29d48f20aa662 10.3s
=> => extracting sha256:6edf5a96c5c0c6448561b857c5fd46c58138c538dab926b72171413fb62480e9 4.6s
=> => extracting sha256:72c59a562e3726965b1cbdb164ad24410b217a9f154fa02d779bfc1f125164ef 0.0s
=> => extracting sha256:801a77eaf0429bcd5f2f1ac3913b63e3bfa7b0c2eb6c3709d02bed3f7aa76e4f 0.2s
=> => extracting sha256:d4b0f3e4da98dd66e69b85ce3522f5b6c50a66cc3a8a9d98f3eb60e0b2751e22 0.0s
=> => extracting sha256:d2e6839152e3e43ff5e9ab5659ae9235b596ad9410a397d240f10760ecb18304 0.0s
=> ERROR [base 2/2] WORKDIR /app 23.7s

[base 2/2] WORKDIR /app:


open /var/lib/docker/overlay2/04b92d28651f74826c5b813be8ac3540b46d20f581bd4013b94cf3c920ed6cbf/merged/etc/passwd: no such file or directory

i have removed few links as it was not allowing me to post