Dotnet-docker: mcr.microsoft.com/dotnet/core/runtime:3.0 doesn't work, sdk works fine

Created on 24 Sep 2019  路  3Comments  路  Source: dotnet/dotnet-docker

Steps to reproduce the issue

  1. Build a dotnet 3.0 app and have files in .dist/Api
  2. docker build -t me/my-image .
    Dockerfile:
FROM mcr.microsoft.com/dotnet/core/runtime:3.0
WORKDIR /app
COPY ./dist/Api ./

ENV SERVER_URLS "http://*:5000"

ENTRYPOINT ["dotnet", "Api.dll", "--server.urls", "${SERVER_URLS}"]
  1. docker run me/my-image

Expected behavior

The container runs (with app, but we didn't expose ports so we can't access it)

Actual behavior

Container crashes with:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '3.0.0' was not found.
  - No frameworks were found.

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download

Additional information (e.g. issue happens only occasionally)

It works when I change "runtime" to "sdk" in the dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.0
WORKDIR /app
COPY ./dist/Api ./

ENV SERVER_URLS "http://*:5000"

ENTRYPOINT ["dotnet", "Api.dll", "--server.urls", "${SERVER_URLS}"]

Output of docker version

Client:
 Version:           19.03.2-ce
 API version:       1.40
 Go version:        go1.13
 Git commit:        6a30dfca03
 Built:             Tue Sep  3 23:41:01 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.2-ce
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13
  Git commit:       6a30dfca03
  Built:            Tue Sep  3 23:39:37 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.9.m
  GitCommit:        d50db0a42053864a270f648048f9a8b4f24eced3.m
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info

Client:
 Debug Mode: false

Server:
 Containers: 88
  Running: 51
  Paused: 3
  Stopped: 34
 Images: 325
 Server Version: 19.03.2-ce
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d50db0a42053864a270f648048f9a8b4f24eced3.m
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.2.14-arch2-1-ARCH
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.52GiB
 Name: archxps
 ID: *snip*
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: mastermindzh
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Most helpful comment

@Mastermindzh - Try changing your base image from mcr.microsoft.com/dotnet/core/runtime:3.0 to mcr.microsoft.com/dotnet/core/aspnet:3.0. The runtime images only contain the .NET Core runtime while the aspnet contain both the .NET Core runtime as well as the ASP.NET Core runtime.

All 3 comments

@Mastermindzh - Try changing your base image from mcr.microsoft.com/dotnet/core/runtime:3.0 to mcr.microsoft.com/dotnet/core/aspnet:3.0. The runtime images only contain the .NET Core runtime while the aspnet contain both the .NET Core runtime as well as the ASP.NET Core runtime.

@MichaelSimons,

Thanks. No idea how we missed that....

Have a good week!

@Mastermindzh, please I'll love to know the use of mcr.microsoft.com/dotnet/core/runtime:3.0
I mean why have the runtime docker image is it doesn't work on docker builds?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twhittakeriq picture twhittakeriq  路  5Comments

galvesribeiro picture galvesribeiro  路  7Comments

girishgouda picture girishgouda  路  7Comments

MichaelSimons picture MichaelSimons  路  5Comments

dapalmi picture dapalmi  路  4Comments