Last post Aug 14, 2019 09:09 AM by wakes
Aug 14, 2019 08:03 AM|wakes|LINK
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
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-1709 AS build
COPY ["BooksApi/BooksApi.csproj", "BooksApi/"]
RUN dotnet restore "BooksApi/BooksApi.csproj"
COPY . .
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
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 ?
Aug 14, 2019 09:09 AM|wakes|LINK
Find it out , it was one level down too much in the path level