docker_basic_dockerize

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker_basic_dockerize [2020/05/02 18:04] – [Troubleshooting] andonovjdocker_basic_dockerize [2020/05/03 11:49] (current) – [Wrong ASP.NET] andonovj
Line 169: Line 169:
 You can have the following error: You can have the following error:
  
 +
 +====Searching wrong Nuget====
 <Code: C#|Nuget Issue> <Code: C#|Nuget Issue>
   Restore completed in 41.36 ms for /app/HttpServerDemo.csproj.   Restore completed in 41.36 ms for /app/HttpServerDemo.csproj.
Line 197: Line 199:
 RUN find -type d -name bin -prune -exec rm -rf {} \; && find -type d -name obj -prune -exec rm -rf {} \;     <- This line RUN find -type d -name bin -prune -exec rm -rf {} \; && find -type d -name obj -prune -exec rm -rf {} \;     <- This line
 ENTRYPOINT ["dotnet", "HttpServerDemo.dll"] ENTRYPOINT ["dotnet", "HttpServerDemo.dll"]
 +</Code>
 +
 +
 +====Wrong ASP.NET====
 +Be careful about the dockerizing the application. I tried to build the application with ASP.NET 2.2 while the app was build with ASP.NET 3.1, so I had to update my Dockerfile as follows:
 +
 +<Code: bash| Updated Docker File>
 +FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env                     <- This line
 +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 mcr.microsoft.com/dotnet/core/aspnet:2.2
 +FROM mcr.microsoft.com/dotnet/core/sdk:3.1
 +WORKDIR /app
 +COPY --from=build-env /app/out .
 +ENTRYPOINT ["dotnet", "HttpServerDemo.dll"]
 +</Code>
 +
 +Otherwise, you will receive the following error:
 +
 +<Code: bash| Error for wrong ASP.NET version>
 +It was not possible to find any compatible framework version
 +The specified framework 'Microsoft.NETCore.App', version '3.1.0' was not found.
 +  - Check application dependencies and target a framework version installed at:
 +      /usr/share/dotnet/
 +  - Installing .NET Core prerequisites might help resolve this problem:
 +      https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
 +  - The .NET Core framework and SDK can be installed from:
 +      https://aka.ms/dotnet-download
 +  - The following versions are installed:
 +      2.2.8 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
 </Code> </Code>
  • docker_basic_dockerize.1588442693.txt.gz
  • Last modified: 2020/05/02 18:04
  • by andonovj