User-2048090339 posted
Dear all,
I have a simple web api project for which I need to host it under Docker image.
For that I have added the following docker file to my root project :
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1709 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-1709 AS build
WORKDIR /src
COPY ["BooksApi/BooksApi.csproj", "BooksApi/"]
RUN dotnet restore "BooksApi/BooksApi.csproj"
COPY . .
WORKDIR "/src/BooksApi"
RUN dotnet build "BooksApi.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "BooksApi.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "BooksApi.dll"]
If I compile and run the app from visual studio , docker file gets compile and runn properly and I can hit my web site api.
Then I have try to compile and run doker image outide visual studio using docker command as explain in different post.
For that I open a powershell command and then run the follwing command from the root of my project :
docker build -t myimage .
by doing so I get a failure error as desribed below :

Any idea what can be wrong ?
regards