Comments (4)
@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"
kvm
is not supported on m1 qemu (for obvious reasons),headless
anddisplay
turns of headless mode for packer. Without them it's really hard to tell if it's working, the build took 12 hours on my machine, so I highly recommend enabling itwindows.iso
is a copy ofiso_url
downloaded locally. Specifying any drives overrides default config, and machine won't boot (no way to tell this in headless mode), so windows iso needs to be here specifically. You can see details here StefanScherer/packer-windows#270 (comment)
Then vagrant box add windows_2019_docker windows_2019_docker_libvirt.box
will add the box.
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
synced_folder
needssmb_host
specified because ping is not implement somehow, as described in the vagrant-qemu's READMEforwarded_port
I added to easily open docker's tcp port. This wouldn't get tricky if you want to run more than one box, but also can be avoided if network is properly setup. But this was the easiest path forward for meqemu_dir
is set to/opt/homebrew/share/qemu
by default, if you're using aarch64 homebrew, you can probably keep the default. I had to change it to my installation
I also changed .ps1
script to set machine ip to 127.0.0.1
(forwarded port):
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:
windows-docker-machine]$ docker context ls
NAME TYPE DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR
2019 moby 2019 windows-docker-machine tcp://127.0.0.1:2376
windows-docker-machine]$ docker --context 2019 run --rm -it mcr.microsoft.com/windows:1809
Microsoft Windows [Version 10.0.17763.3287]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\>dir
Volume in drive C has no label.
Volume Serial Number is 4607-C090
Directory of C:\
04/21/2022 06:12 PM 5,510 License.txt
I hope that helps.
from windows-docker-machine.
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):
$ brew install qemu vagrant
$ vagrant plugin install vagrant-qemu
windows-docker-machine main $ vagrant up --provider qemu 2019-box
Bringing machine '2019-box' up with 'qemu' provider...
==> 2019-box: Box 'StefanScherer/windows_2019_docker' could not be found. Attempting to find and install...
2019-box: Box Provider: libvirt
2019-box: Box Version: >= 0
==> 2019-box: Loading metadata for box 'StefanScherer/windows_2019_docker'
2019-box: URL: https://vagrantcloud.com/StefanScherer/windows_2019_docker
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is
released.
Name: StefanScherer/windows_2019_docker
Address: https://vagrantcloud.com/StefanScherer/windows_2019_docker
Requested provider: ["libvirt"]
Maybe someone could build the box for the provider?
from windows-docker-machine.
And how is the performance of this setup?
Is it possible to work?
from windows-docker-machine.
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.
from windows-docker-machine.
Related Issues (20)
- vagrant up on Mac OS fails: "VBoxManage: error: Unknown option: --nested-hw-virt" HOT 2
- Document the step to remove it HOT 3
- Parallels support? HOT 6
- windows_2019_docker packer build fails on Mac Big sur. HOT 5
- .dockerignore file not respected on MacOS X (VMware) HOT 2
- VirtualBox doesn't allow 192.168.99.0 subnet by default HOT 3
- Apple Silicon Support HOT 1
- Is there any image for Apple silicon M1 macOS? HOT 4
- Plugins failed to load? HOT 1
- Can't connect to published ports from MacOS
- Host-only adapters are no longer supported by Virtualbox HOT 1
- 2019-box is different in configuration from 2019 self-build HOT 1
- Automatic shutdown? HOT 2
- Unable to enableSharedFolders due to VMware Tools HOT 4
- Size of docker disk? HOT 1
- Digest initialization failed: initialization error when running vagrant up HOT 5
- 'docker context ls' does not show '2019-box' HOT 1
- RDP 3389, but got CMD console only HOT 1
- Windows 2019 hangs on Running... HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windows-docker-machine.