Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pulling a Windows Image for Docker on Windows Server 2019 has OS compatibility issues

I have recently tried to pull and run a Docker image (that worked on Windows 10) on a Windows Server 2019 instance which failed with the following error message:

The container operating system does not match the host operating system.

I've tried it on the latest version of Windows Server Core and Nano Server from the normal microsoft/windowsservercore and microsoft/nanoserver repositories.

I don't understand because those are Windows Kernels running on a Windows Operating System.

like image 649
Dandré Avatar asked Apr 11 '19 16:04

Dandré


People also ask

Is Docker compatible with Windows Server 2019?

Running Linux Containers on Windows Server 2019 Out of the box, Docker on Windows only run Windows container. To use Linux containers on Windows Server, you need to use the Docker Enterprise Edition Preview which includes a full LinuxKit system for running Docker Linux containers.

Is Docker compatible with Windows Server?

On Windows Server 2016, Docker and Microsoft came out with container technology that provided a consistent experience across both Linux and Windows Server environments. In 2017, they released Docker Swarm with the ability to create mixed Windows Server and Linux clusters.

Can we run Windows image on Docker?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.

What version of Windows do I need for Docker?

To run Windows containers, you need Windows 10 or Windows 11 Professional or Enterprise edition. Windows Home or Education editions will only allow you to run Linux containers.


2 Answers

Based on the feedback given on this github issue you have to pull the repository from Microsoft's new Container Registry (mcr.microsoft.com) for a specific version (1809). This version is compatible with Windows Server 2019.

docker pull mcr.microsoft.com/windows/servercore:1809

docker pull mcr.microsoft.com/windows/nanoserver:1809

Also beware that nanoserver no longer has Power-Shell in its base image.

As for why this is happening, I am not sure. Would appreciate if anyone could shed some light on the subject.

like image 172
Dandré Avatar answered Nov 14 '22 15:11

Dandré


This error appears because Windows 10 and Windows Server have different Isolation Modes: Hyper-V Isolation for Win 10 and Process Isolation for Win Server. You can find more here

like image 22
Yevhen Visun Avatar answered Nov 14 '22 15:11

Yevhen Visun