Docker - image operating system "windows" cannot be used on this platform

DockerDocker ComposeDockerfileBoot2dockerDocker Machine

Docker Problem Overview


I tried this on my Windows 10 machine:

Dockerfile:

From microsoft/nanoserver
CMD ["echo", "Hello World"]

PS

C:\FSD\Docker\Trial1> docker build -t lea/leatest .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM microsoft/nanoserver
latest: Pulling from microsoft/nanoserver
bce2fbc256ea: Pulling fs layer
58f68fa0ceda: Pulling fs layer
image operating system "windows" cannot be used on this platform

Docker Solutions


Solution 1 - Docker

Your Docker host is configured to run Linux containers inside of a VM. To run Windows containers, you need to "Switch to Windows containers" in the Docker menu. Documentation on that is available here.


Enter image description here

Enter image description here

Solution 2 - Docker

You need to go to the Taskbar → right click the Docker icon → use option Switch to Windows containers...

Source https://docs.docker.com/docker-for-windows/

Enter image description here

Solution 3 - Docker

Switch to Windows Container needs to selected from docker icon running under hidden icon from the bottom right... The moment you switch from Linux to Windows or Windows to Linux, Docker daemon automatically restarts to consider switched container...


I would highly recommend you to view these 2 links to get more insight into how to create window containers:


I really found the content of these links very helpful to make a window container which is still being enhanced for the generic issue we are all are facing since support for window container is yet to mature like Linux containers!

Solution 4 - Docker

microsoft/nanoserver is a windows native container image. So you cannot run this as linux containers run natively. It can only be run on windows 10 or windows server.

If you are in windows 10, you can switch to windows containers by selecting

> switch to windows containers

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLea AView Question on Stackoverflow
Solution 1 - DockerBMitchView Answer on Stackoverflow
Solution 2 - DockerpbaranskiView Answer on Stackoverflow
Solution 3 - DockerAbhishek JainView Answer on Stackoverflow
Solution 4 - DockerprisarView Answer on Stackoverflow