Chip
Chip

Reputation: 1559

How can I run a docker windows container on osx?

I'm running docker for mac and want to start up a windows container. 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? 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

Upvotes: 36

Views: 74194

Answers (4)

John Chung
John Chung

Reputation: 1

I was also able to build the Docker Windows on a Mac with Vmware Fusion 12.

That also seems to work. If you do build the container with Virtual Box, please note you need to install version 6.2 OR lower

https://www.reluctant-tech-traveler.net/prod/user/showblog/running-windows-docker-container-on-mac-1

Upvotes: 0

binford
binford

Reputation: 1805

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:

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

  1. Install vagrant and 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

mcr.microsoft.com/windows/servercore:ltsc2019

Please note that the windows version of your host must match the container image. This is mentioned here: https://hub.docker.com/_/microsoft-windows

Windows requires the host OS version to match the container OS version. If you want to run a container based on a newer Windows build, make sure you have an equivalent host build.

Upvotes: 20

Domingo Pichardo
Domingo Pichardo

Reputation: 15

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.

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. During installation make sure you do not create a Virtual Machine drive, but instead access the bootcamp partition directly.

Upvotes: -2

waldorfsaladx
waldorfsaladx

Reputation: 387

See this link: 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. 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. 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

Upvotes: 8

Related Questions