StefanScherer / windows-docker-machine

Work with Windows containers and LCOW on Mac/Linux/Windows
MIT License
1.04k stars 143 forks source link

Parallels support? #74

Open ntodorov opened 3 years ago

ntodorov commented 3 years ago

Is it doable to add Parallels support for macOS host? Seems they have a vagrant https://parallels.github.io/vagrant-parallels/docs/

My impression is that Parallels the preferred Mac solution, seems better optimized for Mac than VirtualBox, and according to some posts even than VMWareFusion.

Thanks, Nik

StefanScherer commented 3 years ago

Hi @ntodorov Yes, I think that is doable. But I don't have a Parallels license that's why I never had experience with Packer and Vagrant with Parallels. From what I see it should work, nested virtualization is there for hyperv containers.

For a regular rebuild of the Vagrant box I see a problem, I don't have a parallels license and no Mac hardware to spare to run my packer-builder pipeline in the cloud somewhere. I normally only build VirtualBox and VMware boxes every 1-2 months.

But for a local build for someone who has Parallels it would require a change in https://github.com/StefanScherer/packer-windows/blob/main/windows_2019_docker.json to add a packer parallels builder section in the packer build and maybe adding parallels guest tools(?). it's just a packer build away:

$ git clone https://github.com/StefanScherer/packer-windows
$ cd packer-windows
$ packer build --only=parallels-iso windows_2019_docker.json
$ vagrant box add windows_2019_docker windows_2019_docker_parallels.box
$ dm start 2019

And let's see how the virtualization landscape evolves on macOS with the now free for personal use VMware Fusion Player. Vagrant still wants some money for the plugin and I don't know if Player works well with the Vagrant plugin. Maybe there will be a free Player plugin from the community...

ammar-mik commented 3 years ago

I can confirm that building parallels locally works.

However, I get and error on vagrant box add windows_2019_docker windows_2019_docker_parallels.box:

==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'windows_2019_docker' (v0) for provider: 
    box: Downloading: windows_2019_docker_parallels.box
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file /Users/me/code/packer-windows/windows_2019_docker_parallels.box
earljon commented 2 years ago

In any case that other people is looking for an update on this issue. I am able to build a working Parallels box locally using my Macbook running packer. The above posted by @StefanScherer steps definitely worked!

If you like to try it yourself, make sure you have:

If you have Homebrew installed, you can install the SDK by:

Install Parallels Virtualization SDK
$ brew cask install parallels-virtualization-sdk

I was not able to experience the issue that @ammar-mik posted above with this command:

$ vagrant box add earljon/windows_2019_docker /Users/ehidalgo/vbox/windows_2019_docker_parallels.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'earljon/windows_2019_docker' (v0) for provider:
    box: Unpacking necessary files from: file:///Users/ehidalgo/vbox/windows_2019_docker_parallels.box
==> box: Successfully added box 'earljon/windows_2019_docker' (v0) for 'parallels'!

To verify your box:

❯ vagrant box list
earljon/windows_2019_docker       (parallels, 0)

NOTE:

  • Generated .box file is around ~15GB
  • Estimated time of completing the packer build is around ~2.5 hours. Will vary depending on your machine spec.

For running Vagrantfile, just add the new box in your config file and run:

$ vagrant up --provider parallels 2019-box-parallels

Issues and Fixes:

==> 2019-box-parallels: Machine booted and ready!
==> 2019-box-parallels: Checking for Parallels Tools installed on the VM...
==> 2019-box-parallels: Parallels Tools were not detected on this VM! They are required
==> 2019-box-parallels: for shared folders, time sync and more. If shared folders are not
==> 2019-box-parallels: working on this machine, please install Parallels Tools within the
==> 2019-box-parallels: virtual machine and reload your VM.

Hope this steps helps someone trying to run under Parallels provider. Thank you @StefanScherer for providing this wonderful repository!

zhex900 commented 2 years ago

Is nested virtualization a requirement?

Parallel on Apple Silicon does not support nested virtualization. Without nested virtualization, this will not work on M1 macs?

zhex900 commented 2 years ago

windows_2019_docker_parallels.box

@earljon can you share the infra code you used to pack the windows_2019_docker_parallels image?

StefanScherer commented 2 years ago

Nested virtualisation is needed whey you want to run Windows containers in hyperv isolation mode. With the process isolation mode I remember you don't need nested virtualisation.

But running Windows containers on a Mac M1 machine I'm not sure if that works. Windows is amd64, I know that eg. VMware does not support running this on M1. I don't know about Parallels, but would think they have the same problem.