Docker Community Forums

Share and learn in the Docker community.

Docker build failed in my first .Net HelloWord App. Please Help me!

Hi people

This is my first visual studio 2019 console application with docker support (OS: Windows Server 2019). I only want to run a docker container with “hello word”. So I have created a console app with .net core and docker support. The docker file is made automatically by visual studio.
The .net solution project is in: C:\dev\test02\

Then, I go to powershell and execute the docker build command in the same machine:

PS C:\dev\test02\test02> docker build -t dkapp2 .

And it says:

Sending build context to Docker daemon 178.7kB
Step 1/15 : FROM mcr.micro… AS base
—> 6f74053e0977
Step 2/15 : WORKDIR /app
—> Using cache
—> 7a6dce1433d1
Step 3/15 : FROM mcr.micros… AS build
—> a823da05b0b0
Step 4/15 : WORKDIR /src
—> Using cache
—> 732d7b021fde
Step 5/15 : COPY [“test02/test02.csproj”, “test02/”]

COPY failed: CreateFile \?\C:\ProgramData\docker\tmp\docker-builder629812587\test02\test02.csproj: The system cannot find the path specified.

The docker file build automatically buils Visual Studio is:

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.

FROM mcr.microsoft.com/dotnet/core/runtime:2.1-nanoserver-1809 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/core/sdk:2.1-nanoserver-1809 AS build
WORKDIR /src
COPY [“test02/test02.csproj”, “test02/”]
RUN dotnet restore “test02/test02.csproj”
COPY . .
WORKDIR “/src/test02”
RUN dotnet build “test02.csproj” -c Release -o /app

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

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