ASP.NET Core docker build error
Well basically the answer of Celestin Bochis and Pavel Agarkov are great. However since .net core 2.2 at least, the os of docker is stored in the .csproj file.
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> ... </PropertyGroup> ...</Project>
And also don't forget to modify your docker file. The images should be the correct one. For .net core 2.2 That is :
Linux:Microsoft/dotnet:2.2-aspnetcore-runtime AS basemicrosoft/dotnet:2.2-sdk AS buildWindows:microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803microsoft/dotnet:2.2-sdk-nanoserver-1803
Make sure to choose the correct OS when you Enable docker support:
Your docker daemon has to target Linux containers as well.