0

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!

shrimpy
  • 653
  • 3
  • 11
  • 27

1 Answers1

1

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.

Kuikiker
  • 156
  • 13
  • Oh. That was a fast answer! Thank you. I'm gonna be very ignorant : my linux is an AWS instance. So I'm not sure I can run a Windows VM on a Linux Server....? – shrimpy Apr 05 '19 at 10:57
  • Yes, you should be able to run a Windows VM on Linux, for instance using VirtualBox https://itsfoss.com/install-windows-10-virtualbox-linux/ If you are not tied to that Linux AWS instance, you could just deploy a Windows AWS instance instead so that you can directly run windows docker containers there. – Kuikiker Apr 08 '19 at 06:16
  • Thank you, you were the help I needed! – shrimpy Apr 08 '19 at 08:43