Image operating system windows cannot be used on this platform

Docker — образ операционной системы «windows» нельзя использовать на этой платформе.

Я пробовал это на своей машине с Windows 10:

Ваш хост Docker настроен для запуска контейнеров Linux внутри виртуальной машины. Чтобы запустить контейнеры Windows, вам нужно «Перейти на контейнеры Windows» в меню Docker. Документация по этому поводу доступна здесь .

Вам нужно перейти на панель задач → щелкнуть правой кнопкой мыши значок Docker → использовать опцию Переключиться на контейнеры Windows .

microsoft/nanoserver это собственный образ контейнера Windows. Таким образом, вы не можете запустить это, поскольку контейнеры Linux работают изначально. Его можно запустить только на Windows 10 или Windows Server.

Если вы используете Windows 10, вы можете переключиться на контейнеры Windows, выбрав

переключиться на контейнеры Windows

Переключиться на контейнер Windows необходимо выбрать из значка докера, который находится под скрытым значком в правом нижнем углу . В тот момент, когда вы переключаетесь с Linux на Windows или Windows на Linux , Docker демон автоматически перезагружается, чтобы рассмотреть возможность переключения контейнера .

Я настоятельно рекомендую вам просмотреть эти 2 ссылки, чтобы получить больше информации о том, как создавать оконные контейнеры:

Я действительно нашел содержимое этих ссылок очень полезным для создания оконного контейнера, который все еще совершенствуется для решения общей проблемы, с которой мы все сталкиваемся, поскольку поддержка оконных контейнеров еще не сформировалась, как контейнеры Linux!

Mixing Windows and Linux containers with Docker Compose

March 21st, 2019

Premier Developer Consultant Randy Patterson explores how to mix Windows and Linux containers with Docker Compose.

Running Linux containers on a Windows host has been available for awhile now. However, getting Windows and Linux containers to communicate without Docker Compose results in using the containers’ IP Addresses. This is not a good solution since container IP Addresses change often. A better solution is to take advantage of the Docker Compose networking and use the service name instead of the IP address. A Windows host has no problem running Linux containers but Docker Compose does not automatically support multi-platform hosts.

Читайте также:  Windows operating system guide

The platform configuration option was added to Docker Compose files starting with version 2.4 and then removed beginning with version 3.x. It is a know bug and the expectation is that the platform option will return soon. When this article was written, it has not yet appeared in version 3.x so we will continue to use file format version 2.4 for our Docker Compose yaml files.

Setting up your environment

Running Linux containers on Windows and platform support in Docker Compose requires Windows 1803 or greater. I am running Windows 10 1809.

In addition, you must be running the latest version of Docker for Windows and have the experimental features enabled.

If you are running different versions of Windows or Docker your mileage may vary.

Source Code

Next, grab the source code located in the GitHub repo here containing two solutions

  1. Webtier.sln – Asp.Net MVC application running .NET Framework 4.6.x and a Dockerfile for creating a Windows image hosting IIS.
  2. ApiTier.sln – Asp.Net Core 2.1 application and a Dockerfile for creating a Linux image to host the application

The application is a simple web page that displays the hostname of the Web Tier then calls the API Tier to get and display the API hostname. When running in containers, the container Id is displayed. Your Id’s will be different

Docker-Compose

The docker-compose.yml file, located in the root of the solution, adds the platform: windows parameter to the webtier service and the platform: linux parameter to the apitier service.

Next, bring up the multi-container, multi-platform application using docker-compose. Start a powershell prompt in the solutions root folder, the same folder that contains the docker-compose.yml file. Type the command:

Docker Compose will create the images if they do not already exist, then create the virtual network to host the containers and finally start the containers in the correct order.

Finally, retrieve the host port of the webtier container

Use your browser to navigate to http://localhost:38736 (your port number will be different)

If the Windows Web Tier was able to communicate with the Linux API Tier, you will see the id for each of the containers (your id’s will be different) on the web page.

Using the platform option in your configuration files allows Docker Compose to mix Windows and Linux containers when hosted on a multi-platform host like Windows. Keep in mind that this is an experimental feature and is not yet ready for production environments.

Developer Support

Microsoft Developer Support

Read next

3 comments

Hi,
a very nice article.
I am using LCOW for several months and it works for integration tests ina mixed environment very well.But now I have a problem using microsoft/dotnet:2.2-aspnetcore-runtime(or …-alpine) for the linux images.
Building the docker image on linux with this base image and running it in anLCOW environment works in that way that the container starts and itsfunctions are available.
But if I want to stop the container it takes several minutes to stop thecontainer.
Do you have any idea why it takes so long?
Best regardsChristian

Читайте также:  Xbox console companion windows 10 что это

Thanks for the comment Christian. LCOW containers taking a long time to stop is a known issue that hasn’t been fixed yet. I don’t always experience it with ‘docker stop’ but I do with ‘docker-compose down’. Just be patient for now and don’t kill the process. ‘docker-compose down’ will also remove the network it created and if that gets interupted it can be difficult to fix.

error:image operating system «windows» cannot be used on this platform #8

Comments

ElderJames commented Aug 30, 2017 •

I had install the Docker On Windows,but when I run the command docker pull microsoft/azure-cosmosdb-emulator and the error image operating system «windows» cannot be used on this platform back.

The text was updated successfully, but these errors were encountered:

abhijit838 commented Sep 9, 2017

Having the same problem.

abhijit838 commented Sep 9, 2017

Solved. You just have to switch to Windows container form docker menu.
Here is the reference doc. https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers

ElderJames commented Sep 9, 2017

My problem is happen on windows mode.

sumit480 commented Sep 28, 2017

Solve by using @abhijit838 solutions and its working now. Thanks for the info.

bremnes commented Oct 3, 2017

@ElderJames, are you still experiencing this problem? Run docker version in cmd or powershell and take a look at what OS/Arch is saying for both Client and Server. Hopefully it should say something similar to windows/amd64 .

conradmurray commented Dec 18, 2018

because I hadn’t selected the Windows option at Install, I had to uninstall and reinstall. Then, that still didn’t work so I uninstalled, deleted the Docker and DockerDesktop folders from ProgramFiles and ProgramData, ten re-installed, then switched. and then it worked.

hans204 commented May 7, 2019

Having the same problem.How Win7 to Switch the Windows container

sumantfordev commented Aug 20, 2019

i am having the same problem, i am aware of the limitation of windows vs linux image difference because of which this is coming. But i am looking a for a solution on this because i just want to pull image from an repo and push it to another repo. That also not possible because of this limitation.

Abubakar22 commented Aug 29, 2020

@ElderJames, are you still experiencing this problem? Run docker version in cmd or powershell and take a look at what OS/Arch is saying for both Client and Server. Hopefully it should say something similar to windows/amd64 .

My Client version says windows but Server says Linux, I have installed Docker on WIndows though. Here is my Docker version

Читайте также:  Mac os внешний жесткий только для чтения

When I hit docker pull below is the response

Docker — image operating system “windows” cannot be used on this platform

I tried this on my Windows 10 machine:

5 Answers 5

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.

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

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!

Error image operating system «linux» cannot be used on this platform on Windows 10 #27668

Comments

happysysadm commented Oct 23, 2016

I am unable to run a linux container (like Ubuntu) on a windows 10 host.

docker run ubuntu Unable to find image ‘ubuntu:latest’ locally latest: Pulling from library/ubuntu C:\Program Files\Docker\docker.exe: image operating system «linux» cannot be used on this platform. See ‘C:\Program Files\Docker\docker.exe run —help’.

docker version
Client:
Version: 1.13.0-dev
API version: 1.25
Go version: go1.7.3
Git commit: 95c36b3
Built: Fri Oct 21 17:13:27 2016
OS/Arch: windows/amd64

Server:
Version: 1.13.0-dev
API version: 1.25
Go version: go1.7.3
Git commit: 95c36b3
Built: Fri Oct 21 17:13:27 2016
OS/Arch: windows/amd64

docker info
Containers: 10
Running: 0
Paused: 0
Stopped: 10
Images: 2
Server Version: 1.13.0-dev
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat nat null null transparent
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 14393 (14393.321.amd64fre.rs1_release_inmarket.161004-2338)
Operating System: Windows 10 Enterprise N 2016 LTSB
OSType: windows
Architecture: x86_64
CPUs: 4
Total Memory: 15.88 GiB
Name: win10pc
ID: PAU2:6PDB:FU47:KCOP:XDWO:EZ3B:KD3E:26HQ:FLY3:EI23:AWLU:SFO7
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):
My environment is a physical Windows 10 version 1607 (build 14393.321).

The text was updated successfully, but these errors were encountered:

Оцените статью