0

I have a dotnet 6 console app, using the default dockerfile. Using Linux continars, WSL with Ubuntu. When I run via Docker or Docker Compose, the app fails to start, with message:

The specified framework can be found at: - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=6.0.0&arch=x64&rid=debian.11-x64

The generated Dockefile starts

FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base

But if I change it to

FROM mcr.microsoft.com/dotnet/**aspnet**:6.0 AS base

It works

This is not an ASP.NET app... why does running it require me to switch the image to use an aspnet image?

For ref here is my csproj

<Project Sdk="Microsoft.NET.Sdk.Worker">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <UserSecretsId>dotnet-Kafka2HC-5DC15C29-D1E6-40D6-8A93-5A669A0C0F4F</UserSecretsId>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <ServerGarbageCollection>true</ServerGarbageCollection>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Confluent.Kafka" Version="1.8.2" />
    <PackageReference Include="Dapper" Version="2.0.123" />
    <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
    <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
    <PackageReference Include="Serilog.Extensions.Hosting" Version="4.2.0" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
    <PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
    <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
    <PackageReference Include="IdentityModel.AspNetCore" Version="4.2.0" />
  </ItemGroup>
</Project>
John Waters
  • 689
  • 2
  • 8
  • 16
  • `IdentityModel.AspNetCore` looks kind of asp.net like. – Hans Kilian Apr 25 '22 at 16:43
  • https://stackoverflow.com/a/65168572/11182 In short, you need some bits not in the smallest runtime, so the ASP.NET Core runtime is required. – Lex Li Apr 25 '22 at 21:13
  • Interesting - that nuget is in there so that the app can make API calls with access token management. Funny that this brings in a dependency on the aspnetcore runtime! – John Waters Apr 26 '22 at 18:19

0 Answers0