I'm trying to dockerize a aspnetcore webapi. I followed the tutorial here: https://docs.docker.com/engine/examples/dotnetcore/
But when I run my container I have this message:
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
I download the code and build the image from the Dockerfile the github site:
https://github.com/dotnet/dotnet-docker-samples/tree/master/aspnetapp
I run the container... and it works... I compared two Dockerfile and they are very similar:
Mine:
FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/aspnetcore:2.0.5
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "fnizz.webapi.dll"]
And the one from the github sample:
FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
If there is missing info, tell me, I'll add it. Thank you !