Help with Docker
-
Hi all, I'm dipping my toes into the world of Docker and thought as part of my learning curve I'd try and containerize a recent net core api project. I've written a Dockerfile which seems to build the image ok but fails when I try running it with a file not found error. Any ideas guys ? This is only the beginning as the API makes calls to a postgresql database but the Docker way seems to be layered so I thought I'd start with the API first - am I correct doing it this way ? Docker file
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "MyAPI.dll"]"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
-
Hi all, I'm dipping my toes into the world of Docker and thought as part of my learning curve I'd try and containerize a recent net core api project. I've written a Dockerfile which seems to build the image ok but fails when I try running it with a file not found error. Any ideas guys ? This is only the beginning as the API makes calls to a postgresql database but the Docker way seems to be layered so I thought I'd start with the API first - am I correct doing it this way ? Docker file
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "MyAPI.dll"]"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
-
Did the file "not found" have a name?
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Yes my API assembly name
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
I suspect that your build has actually gone into the app/out folder rather than the app folder.
-
I suspect that your build has actually gone into the app/out folder rather than the app folder.
Thanks Pete what can I do to change that ? Edit I managed to suss it I out think, well it runs
Get Base Image (Full .NET Core SDK)
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /appCopy csproj and restore
COPY *.csproj ./
RUN dotnet restoreCopy everything else and build
COPY . ./
RUN dotnet publish -c Release -o outGenerate runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "AllValvesAPI.dll"]"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP