-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Is this compatible with m1 MacOS? #84
Comments
I believe it is not. The procedures herein rely on virtualbox, which doesn't support Apple Silicon. It's possible it could be made to work with VMWare or Parallels or UTM, which can run Windows VMs, but I wouldn't know how to do that. |
Today I learned that UTM is backed by qemu, which has a vagrant provider. I tried spinning up the box using qemu, but without success (reasonably, because the images haven't been built):
Maybe someone could build the box for the provider? |
@jaraco I sort-of made it work, it's not as easy as just building the box. For packer-windows you need the following changes: diff --git a/windows_2019_docker.json b/windows_2019_docker.json
index 921e1e0..e6d89f0 100644
--- a/windows_2019_docker.json
+++ b/windows_2019_docker.json
@@ -1,7 +1,6 @@
{
"builders": [
{
- "accelerator": "kvm",
"boot_wait": "0s",
"communicator": "winrm",
"cpus": 2,
@@ -15,7 +14,8 @@
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1"
],
- "headless": true,
+ "headless": false,
+ "display": "cocoa",
"iso_checksum": "{{user `iso_checksum`}}",
"iso_url": "{{user `iso_url`}}",
"memory": "{{user `memory`}}",
@@ -25,6 +25,10 @@
"-drive",
"file=windows_2019_docker-qemu/{{ .Name }},if=virtio,cache=writeback,discard=ignore,format=qcow2,index=1"
],
+ [
+ "-drive",
+ "file=windows.iso,media=cdrom,index=2"
+ ],
[
"-drive",
"file={{ user `virtio_win_iso` }},media=cdrom,index=3"
Then I had to change vagrant-qemu code. These lines https://github.com/ppggff/vagrant-qemu/blob/36eb93afc951650c2bc801ec989f8c221f36f077/lib/vagrant-qemu/action/start_instance.rb#L43-L46 should be host_ip = ""
# host_ip = "#{options[:host_ip]}:" if options[:host_ip]
guest_ip = ""
# guest_ip = "#{options[:guest_ip]}:" if options[:guest_ip]
result.push("#{options[:protocol]}:#{host_ip}:#{options[:host]}-#{guest_ip}:#{options[:guest]}") my version of qemu wasn't happy about host in port forwarding rules. Vagrant file changes are: diff --git a/Vagrantfile b/Vagrantfile
index 2a711bf..cd88469 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -8,7 +8,8 @@ Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", disabled: true
home = ENV['HOME'].gsub('\\', '/')
- config.vm.synced_folder home, home
+ config.vm.synced_folder home, home, type: "smb", smb_host: "10.0.2.2"
+ config.vm.network "forwarded_port", guest: 2376, host: 2376
config.vm.define "2016", autostart: false do |cfg|
cfg.vm.box = "windows_2016_docker"
@@ -107,6 +108,18 @@ Vagrant.configure("2") do |config|
v.customize ["modifyvm", :id, "--paravirtprovider", "hyperv"]
end
+ config.vm.provider "qemu" do |v, override|
+ v.gui = false
+ v.memory = 2048
+ v.cpus = 2
+ v.linked_clone = true
+ v.arch = "x86_64"
+ v.machine = "pc"
+ v.cpu = "max"
+ v.net_device = "virtio-net-pci"
+ v.qemu_dir = "/nix/store/azrccc44b425xh1v5bk9sxi2hf15v8mj-qemu-7.0.0/share/qemu/"
+ end
+
config.vm.provider "hyperv" do |v|
v.cpus = 2
v.maxmemory = 2048
I also changed diff --git a/scripts/create-machine.ps1 b/scripts/create-machine.ps1
index 174cacb..ab60c31 100644
--- a/scripts/create-machine.ps1
+++ b/scripts/create-machine.ps1
@@ -9,13 +9,14 @@ if (!(Test-Path $env:USERPROFILE\.docker)) {
$ipAddresses = ((Get-NetIPAddress -AddressFamily IPv4).IPAddress) -Join ','
if (!$machineIp) {
- $machineIp=(Get-NetIPAddress -AddressFamily IPv4 `
- | Where-Object -FilterScript { `
- ( ! ($_.InterfaceAlias).StartsWith("vEthernet (") ) `
- -And $_.IPAddress -Ne "127.0.0.1" `
- -And $_.IPAddress -Ne "10.0.2.15" `
- -And !($_.IPAddress.StartsWith("169.254.")) `
- }).IPAddress
+ $machineIp="127.0.0.1"
+ # $machineIp=(Get-NetIPAddress -AddressFamily IPv4 `
+ # | Where-Object -FilterScript { `
+ # ( ! ($_.InterfaceAlias).StartsWith("vEthernet (") ) `
+ # -And $_.IPAddress -Ne "127.0.0.1" `
+ # -And $_.IPAddress -Ne "10.0.2.15" `
+ # -And !($_.IPAddress.StartsWith("169.254.")) `
+ # }).IPAddress
} else {
$ipAddresses = "$ipAddresses,$machineIp"
} I was able to run docker after these changes:
I hope that helps. |
And how is the performance of this setup? |
No description provided.
The text was updated successfully, but these errors were encountered: