Search code examples
linuxdockerasp.net-corelinux-containers

ASPNETCORE containers loading on linux server, but "image operating system "windows" cannot be used on this platform"


Another day, another docker problem. I am currently working on an aspnetcore app in a container that I want to run on an Ubuntu 18.04. Here is my Dockerfile:

FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
RUN dotnet restore FOLDER
RUN dotnet build FOLDER
FROM build AS publish
RUN dotnet publish
(I didn't put names or some steps as copy)

In my deployment CI, it returns image operating system "windows" cannot be used on this platform. I have pulled those 2 images directly on the server and they pulled fine.

I have initially build with --isolation=hyperv.

I am quite new to linux containers and servers, therefore I am not sure where the problem is coming from...

Thanks for your help!


Solution

  • Basically, you cannot run windows containers in Linux.

    Taken from Can Windows Containers be hosted on linux?

    Containers are not for virtualization, and they are using the resources of the host machine. As a result, for now windows container cannot run "as-is" on linux machine. But - you can do it by using VM - as it works on windows. You can install windows VM on your linux host, which will allow to run windows containers.