aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Error running docker container

Open Raja-Ashutosh opened this issue 7 years ago • 4 comments

Describe the bug

Trying to create and run AspDotNetCode mvc project in the window docker container, facing the below error.

docker run --name aspnetcoretodo_sample --rm -it -p 8090:80 aspnotnetcoretodo
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.1' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\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

Environment: 1.ASP.NET Core netcoreapp2.1(2.2.102) 2. Run this code - windows 10 3.Client: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:21:34 2018 OS/Arch: windows/amd64 Experimental: false

Server: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.24) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:36:40 2018 OS/Arch: windows/amd64 Experimental: false

Raja-Ashutosh avatar Jan 11 '19 14:01 Raja-Ashutosh

@Raja-Ashutosh can you share your Dockerfile?

My guess is you have a stale image and need to run docker pull.

natemcmaster avatar Jan 11 '19 15:01 natemcmaster

FROM microsoft/dotnet:2.1-sdk AS build

WORKDIR /app/AspDotNetCoreTodo

COPY *.csproj ./

RUN dotnet restore

COPY . ./

RUN dotnet publish -o out /p:PublishWithAspNetCoreTargetManifest="false"

FROM microsoft/dotnet:2.1-runtime AS runtime

ENV ASPNETCORE_URLS http://+:80

WORKDIR /app

COPY --from=build /app/AspDotNetCoreTodo/out ./

ENTRYPOINT ["dotnet", "AspDotNetCoreTodo.dll"]

Raja-Ashutosh avatar Jan 14 '19 05:01 Raja-Ashutosh

You are using the wrong base image. Make this change, and I think it will resolve the problem.

-FROM microsoft/dotnet:2.1-runtime AS runtime
+FROM microsoft/dotnet:2.1-aspnetcore-runtime AS runtime

See https://github.com/dotnet/dotnet-docker/blob/master/samples/aspnetapp/README.md for more details.

natemcmaster avatar Jan 14 '19 17:01 natemcmaster

Thanks its working

Raja-Ashutosh avatar Jan 14 '19 17:01 Raja-Ashutosh