I create my application and it successfully creates the docker container. When I try and run it
docker run -it --name myapp myapp:latest
I get the following error:
The specified framework 'Microsoft.AspNetCore.All', version '2.1.2' was not found.
...
- The following versions are installed:
2.1.1 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
When I log into the container, I can see that, in the /usr/share/dotnet/shared/Microsoft.AspNetCore.All
folder, there is one subfolder called 2.1.2
.
I can't figure out why it's saying that 2.1.1 is installed and 2.1.2 is not??
The following is my Dockerfile:
FROM microsoft/dotnet:2.1.400-sdk-stretch AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1.400-sdk-stretch AS build
WORKDIR /src
COPY source/application/MyApp/MyApp.csproj source/application/MyApp/
COPY source/application/MyApp.DependentProject/MyApp.DependentProject.csproj source/application/MyApp/
RUN dotnet restore source/application/MyApp/MyApp.csproj
COPY . .
WORKDIR /src/source/application/MyApp
RUN dotnet build MyApp.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish MyApp.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MyApp.dll"]
You could try changing:
FROM microsoft/dotnet:2.1.400-sdk-stretch AS base
to
FROM microsoft/dotnet AS base
or
FROM microsoft/dotnet:2.1.2-sdk AS base
See the docker docs and Microsoft docs on dotnet core and docker for further examples
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.