简体   繁体   English

如何在 osx 上运行 docker windows 容器?

[英]How can I run a docker windows container on osx?

I'm running docker for mac and want to start up a windows container.我正在运行 docker for mac 并想启动一个 Windows 容器。 From what I see this should work via a virtual machine.从我看来,这应该通过虚拟机工作。 But I'm unclear where to find out how to get it to work?但我不清楚在哪里可以找到如何让它工作? Or does it only work for linux containers?或者它只适用于 linux 容器? Thanks in advance!提前致谢!

docker build nanoserver/
Sending build context to Docker daemon   2.56kB
Step 1/6 : FROM microsoft/nanoserver:10.0.14393.1480
10.0.14393.1480: Pulling from microsoft/nanoserver
bce2fbc256ea: Pulling fs layer 
baa0507b781f: Pulling fs layer 
image operating system "windows" cannot be used on this platform

See this link: https://forums.docker.com/t/how-do-i-start-a-windows-docker-container-on-my-mac-os-x/12953/2 看到此链接: https : //forums.docker.com/t/how-do-i-start-a-windows-docker-container-on-my-mac-os-x/12953/2

Text if you can't follow the link: 如果您无法点击链接,请输入以下文字:

On OS X, get VirtualBox. 在OS X上,获取VirtualBox。 Get Windows Server 2016 Tech Preview 5 ISO167 (free download from Microsoft) Create WS 2016 TP5 VM in virtualbox Run this206 in the new VM Now you can run Windows Containers in the VM. 获取Windows Server 2016 Tech Preview 5 ISO167(可从Microsoft免费下载)在virtualbox中创建WS 2016 TP5 VM在新VM中运行this206现在,您可以在VM中运行Windows容器。 To make the setup a little easier to use, see this: https://forums.docker.com/t/windows-server-2016-tp5-docker-server-remote-management/10315/5317 为了使设置更易于使用,请参见以下内容: https : //forums.docker.com/t/windows-server-2016-tp5-docker-server-remote-management/10315/5317

You could also install Bootcamp on your machine which allows you to dual boot your computer between OS X and Windows 10. You could then use the full power of your hardware dedicated to Windows and docker instead of virtualization. 您还可以在计算机上安装Bootcamp,这使您可以在OS X和Windows 10之间双重引导计算机。然后,您可以使用Windows和docker专用硬件的全部功能,而不必使用虚拟化。

Additionally, you can make the use of VMWare Fusion for Mac OS or Parallels, which allow you to ALSO access the dual boot windows partition from within the Mac OS for maximum flexibility. 此外,您可以使用适用于Mac OS或Parallels的VMWare Fusion,它们还可以从Mac OS内部访问双引导窗口分区,以实现最大的灵活性。 During installation make sure you do not create a Virtual Machine drive, but instead access the bootcamp partition directly. 在安装过程中,请确保您没有创建虚拟机驱动器,而是直接访问bootcamp分区。

I know I am late to the party but as of 2021, this is the easiest setup to get a windows container running on macOS:我知道我迟到了,但截至 2021 年,这是在 macOS 上运行 Windows 容器的最简单设置:

https://github.com/StefanScherer/windows-docker-machine https://github.com/StefanScherer/windows-docker-machine

  1. Install vagrant and virtual box安装 vagrant 和 virtual box
  2. Clone the repository above and change directory into it克隆上面的存储库并将目录更改为它
  3. vagrant up --provider virtualbox 2019-box
  4. docker context use 2019-box

I followed this setup and I could use the following windows image我遵循了这个设置,我可以使用以下 Windows 图像

mcr.microsoft.com/windows/servercore:ltsc2019

Please note that the windows version of your host must match the container image.请注意,主机的 Windows 版本必须与容器映像匹配。 This is mentioned here: https://hub.docker.com/_/microsoft-windows这里提到了这一点: https : //hub.docker.com/_/microsoft-windows

Windows requires the host OS version to match the container OS version. Windows 要求主机操作系统版本与容器操作系统版本匹配。 If you want to run a container based on a newer Windows build, make sure you have an equivalent host build.如果要运行基于较新 Windows 版本的容器,请确保您具有等效的主机版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Windows 上运行 Windows Docker 容器而没有“打开 \\.\pipe\docker_engine_windows:系统找不到指定的文件”? - How can I run a Windows Docker container on Windows without "open \\.\pipe\docker_engine_windows: The system cannot find the file specified"? 在Windows中运行Docker容器 - Run a docker container into Windows 如何在 linux 主机上运行 windows docker 容器? - How to run a windows docker container on linux host? 如何在 Windows 上同时运行 Docker 和 Android Studio 模拟器? - How can I run both Docker and Android Studio Emulator on Windows? 无法让 Windows Docker 容器“以管理员身份运行” - Can't get a Windows Docker container to "run as administrator" Boot2docker / Windows:无法在Ubuntu容器上运行bash - Boot2docker/Windows: can't run bash on Ubuntu container 无法运行 Windows docker 容器中路径中的可执行文件 - Can't run executable that is in Path in Windows docker container 如何在 windows 中创建 Docker 容器以在 ubuntu vm 中运行 - How to create Docker container in windows to run in ubuntu vm 如何创建一个Dockerfile在Windows 2016容器中运行Docker? - How to Create a Dockerfile to Run Docker in a Windows 2016 Container? 如何在 docker 容器内运行 windows 无头服务器? - How to run windows headless server inside a docker container?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM