### Run Custom Install Script Source: https://github.com/dockur/windows/blob/master/readme.md Bind a local folder containing an install.bat script and any necessary files to the /oem directory to execute the script after installation. ```yaml volumes: - ./example:/oem ``` -------------------------------- ### Start wsdd-native Service Source: https://github.com/dockur/windows/blob/master/_autodocs/06-networking-samba.md Starts the wsdd-native service for WSD/WSDD discovery on the eth0 interface. ```bash wsddn -b eth0 ``` -------------------------------- ### Launch Unattended Windows Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This script launches the unattended Windows Setup process using a preloaded ISO and an unattend.xml file. Ensure the ISO and unattend.xml are correctly mounted and accessible. ```bash # Mounted ISO path ISO="/mnt/install.iso" # Windows Setup executable path Setup="$ISO/setup.exe" # Unattend.xml location (typically /) Unattend="/unattend.xml" # Launch setup with unattend parameter "$Setup" /unattend:"$Unattend" ``` -------------------------------- ### Accessing Windows Setup Logs Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This command shows how to access Windows Setup log files after the system has booted. Navigate to the C:\Windows\Panther\ directory to view logs like setupact.log and setuperr.log. ```bash # RDP or VNC into Windows after boot completes # Navigate to C:\Windows\Panther\ # View setupact.log, setuperr.log, etc. ``` -------------------------------- ### Install and Verify QEMU Guest Agent in Windows Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Steps to install the QEMU Guest Agent within a Windows guest and verify its service status. This enables guest management features. ```powershell # Download from qemu.org or github # Run installer # Verify Get-Service QEMU-GA | Start-Service ``` -------------------------------- ### Configure Primary Disk Pass-through Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Map a physical host disk (e.g., `/dev/sdb`) to a device within the container (e.g., `/disk1`) for the primary Windows installation (C: drive). Windows Setup will format this disk. ```yaml devices: - /dev/sdb:/disk1 # Maps to primary installation disk ``` -------------------------------- ### Enable Manual Installation Source: https://github.com/dockur/windows/blob/master/readme.md Set the MANUAL environment variable to 'Y' to perform a manual installation instead of the recommended automatic one. ```yaml environment: MANUAL: "Y" ``` -------------------------------- ### Start Windows 11 Container Source: https://github.com/dockur/windows/blob/master/_autodocs/00-index.md Use this command to start a Windows 11 container with specified RAM, CPU, and port mappings. Ensure necessary devices and capabilities are passed through for optimal performance and networking. ```bash docker run -d \ --name windows \ -e VERSION=11 \ -e RAM_SIZE=8G \ -e CPU_CORES=4 \ --device=/dev/kvm \ --device=/dev/net/tun \ --cap-add NET_ADMIN \ -p 8006:8006 \ -p 3389:3389/tcp \ -p 3389:3389/udp \ -v windows:/storage \ dockurr/windows:latest ``` -------------------------------- ### Start smbd Daemon Source: https://github.com/dockur/windows/blob/master/_autodocs/06-networking-samba.md Starts the Samba SMB server daemon in the foreground. ```bash smbd --daemon --foreground ``` -------------------------------- ### TXTSETUP.SIF Driver Sections Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md Configuration for the TXTSETUP.SIF file to load VirtIO and IAStor drivers during Windows setup. ```ini [SCSI.Load] viostor=viostor.sys,4 iaStor=iaStor.sys,4 [HardwareIdsDatabase] PCI\VEN_1AF4&DEV_1001="viostor" ``` -------------------------------- ### Basic Docker Run Command for Windows Source: https://github.com/dockur/windows/blob/master/_autodocs/README.md This command starts a Windows container in detached mode, setting the version and RAM size, mapping host devices and ports, and mounting a volume for storage. It's a common starting point for using the Windows Docker image. ```bash docker run -d \ --name windows \ -e VERSION=11 \ -e RAM_SIZE=8G \ --device=/dev/kvm \ -p 8006:8006 \ -p 3389:3389 \ -v windows:/storage \ dockurr/windows:latest ``` -------------------------------- ### Build Docker Image Locally Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Builds a Docker image with the tag 'mywindows:latest' from the current directory. Ensure Docker is installed and running. ```bash docker build -t mywindows:latest . ``` -------------------------------- ### Minimal Windows Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/00-index.md A basic Docker Compose configuration for running the Windows image with default settings. Exposes RDP and the web UI ports and mounts a local storage volume. ```yaml services: windows: image: dockurr/windows ports: - 8006:8006 - 3389:3389 volumes: - ./windows:/storage ``` -------------------------------- ### Bash Function to Prepare Windows Installation ISO with Drivers Source: https://github.com/dockur/windows/blob/master/_autodocs/03-version-system.md The prepareInstall function modifies a Windows ISO to include VirtIO drivers for older versions. It requires the directory of the extracted ISO contents, a version description, and the driver target version as parameters. ```bash prepareInstall() { local pid="" local file="" local dir="$2" local desc="$3" local driver="$4" } ``` -------------------------------- ### Run QEMU Indefinitely Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md This command starts the QEMU process, which by default runs indefinitely. The container will persist until explicitly stopped. ```bash exec "${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" ``` -------------------------------- ### Configure QEMU Arguments for Network Interface Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Use the ARGUMENTS environment variable to pass custom QEMU command-line arguments. This example specifies a MAC address for a virtio-net-pci device. ```yaml environment: ARGUMENTS: "-device virtio-net-pci,mac=52:54:00:12:34:56" ``` -------------------------------- ### Add Custom Samba Share Source: https://github.com/dockur/windows/blob/master/_autodocs/06-networking-samba.md Example of adding a new share configuration to Samba. ```ini [Data] path = /data comment = Data Storage read only = No browsable = Yes ``` -------------------------------- ### Example Unattend.xml Structure for Windows PE Pass Source: https://github.com/dockur/windows/blob/master/_autodocs/03-version-system.md This XML snippet illustrates the basic structure of an Unattend.xml file, focusing on the 'windowsPE' pass. It shows common components for internationalization and Windows setup configuration. ```xml ``` -------------------------------- ### Configure QEMU Arguments for USB Passthrough Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Use the ARGUMENTS environment variable to pass custom QEMU command-line arguments. This example demonstrates passing a USB host device using vendor and product IDs. ```yaml environment: ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x5678" ``` -------------------------------- ### Run Windows Docker Image with Full Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md This command demonstrates a comprehensive setup for running the Windows Docker image. It includes environment variables for version, resources, user credentials, display settings, and network configuration. Volume mounts are specified for persistent storage and shared data. Device mappings and capabilities are also included for enhanced functionality. ```bash docker run -it --rm \ --name windows \ -e VERSION=11 \ -e RAM_SIZE=8G \ -e CPU_CORES=4 \ -e DISK_SIZE=128G \ -e USERNAME=docker \ -e PASSWORD=admin \ -e LANGUAGE=English \ -e REGION=en-US \ -e KEYBOARD=en-US \ -e WIDTH=1920 \ -e HEIGHT=1080 \ -e DHCP=Y \ --device=/dev/kvm \ --device=/dev/net/tun \ --cap-add NET_ADMIN \ -p 8006:8006 \ -p 3389:3389/tcp \ -p 3389:3389/udp \ -v "${PWD}/windows:/storage" \ -v "${PWD}/windows2:/storage2" \ -v "${PWD}/shared:/shared" \ -v "${PWD}/oem:/oem" \ --stop-timeout 120 \ dockurr/windows:latest ``` -------------------------------- ### Enable ISO Removal After Installation Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Set REMOVE to 'Y' to automatically delete the downloaded ISO image after a successful installation, saving disk space. ```yaml environment: REMOVE: "Y" ``` -------------------------------- ### Execute Post-Installation Scripts Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This batch script is executed after Windows installation completes. It can be used for software installation, system configuration, and registry modifications. Ensure the script is placed in the correct OEM directory. ```batch @echo off REM Install custom software cd /oem start /wait installer.exe /S REM Configure Windows reg add HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /v NoAutoUpdate /t REG_DWORD /d 1 /f REM Complete exit /b 0 ``` -------------------------------- ### Troubleshoot USB Device Passthrough Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Verify the device is listed by `lsusb`, check QEMU arguments in container logs, ensure Windows drivers are installed, and confirm file permissions for the USB device. ```bash lsusb | grep "1234:5678" ``` ```bash # From container logs: ps aux | grep qemu # Should show: -device usb-host,vendorid=0x1234,... ``` ```bash ls -l /dev/bus/usb/001/005 # Should be readable/writable by container user ``` -------------------------------- ### Dockerfile Entry Point Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Configures the container's entry point using tini as a process manager (PID 1) to ensure clean shutdowns, followed by the main startup script entry.sh. This defines how the container starts and manages its processes. ```dockerfile ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"] ``` -------------------------------- ### Windows Server Edition Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/00-index.md Docker Compose configuration for deploying Windows Server editions with custom network settings. Allows specifying server version, edition, resources, and user credentials. Requires KVM device for virtualization. ```yaml services: windows-server: image: dockurr/windows environment: VERSION: "2022" # Windows Server 2022 EDITION: "Datacenter" RAM_SIZE: "32G" CPU_CORES: "16" DISK_SIZE: "512G" USERNAME: "admin" PASSWORD: "SecurePass123" devices: - /dev/kvm networks: server-net: ipv4_address: 10.0.0.100 volumes: - server-storage:/storage ``` -------------------------------- ### Windows Docker Architecture Diagram Source: https://github.com/dockur/windows/blob/master/_autodocs/00-index.md A visual representation of the dockurr/windows Docker image architecture, showing the container layers, initialization scripts, QEMU setup, and the Windows guest OS. ```text ┌─────────────────────────────────────────┐ │ Docker Container (dockurr/windows) │ ├─────────────────────────────────────────┤ │ │ │ Entry Point: entry.sh │ │ ├─ Initialization Chain │ │ │ ├─ start.sh (hooks) │ │ │ ├─ utils.sh (functions) │ │ │ ├─ reset.sh (cleanup) │ │ │ ├─ server.sh (web server) │ │ │ ├─ define.sh (version detect) │ │ │ ├─ mido.sh (ISO download) │ │ │ ├─ install.sh (Windows setup) │ │ │ ├─ disk.sh (disk config) │ │ │ ├─ display.sh (graphics) │ │ │ ├─ network.sh (networking) │ │ │ ├─ samba.sh (file sharing) │ │ │ ├─ boot.sh (boot config) │ │ │ ├─ proc.sh (CPU config) │ │ │ ├─ power.sh (shutdown) │ │ │ ├─ memory.sh (RAM check) │ │ │ ├─ balloon.sh (ballooning) │ │ │ ├─ config.sh (QEMU args) │ │ │ └─ finish.sh (finalization) │ │ │ │ │ └─ QEMU Launch │ │ ├─ KVM Acceleration (optional) │ │ ├─ Virtual CPUs & RAM │ │ ├─ Virtual Disks (QCOW2) │ │ ├─ VirtIO Drivers │ │ └─ VNC Display Server │ │ │ │ Windows (Inside QEMU) │ │ ├─ Unattended Installation │ │ ├─ Driver Installation │ │ ├─ OEM Customization (install.bat) │ │ └─ Ready for Use │ │ │ └─────────────────────────────────────────┘ ``` -------------------------------- ### Configure Username and Password Source: https://github.com/dockur/windows/blob/master/readme.md Set custom credentials for the default user during installation using the USERNAME and PASSWORD environment variables. Defaults are 'Docker' and 'admin'. ```yaml environment: USERNAME: "bill" PASSWORD: "gates" ``` -------------------------------- ### Specify Windows Version Source: https://github.com/dockur/windows/blob/master/readme.md Set the VERSION environment variable to select a specific Windows version for installation. Available values are listed in the documentation. ```yaml environment: VERSION: "11" ``` -------------------------------- ### Verify KVM Support on Linux Source: https://github.com/dockur/windows/blob/master/readme.md Install the cpu-checker package and run 'kvm-ok' to verify KVM support on your Linux system. If KVM is not usable, check BIOS settings for virtualization extensions and ensure nested virtualization is enabled if running within a VM. ```bash sudo apt install cpu-checker sudo kvm-ok ``` -------------------------------- ### Windows PE Pass Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md Example configuration for the windowsPE pass in an Unattend.xml file, setting internationalization and disk configuration. ```xml en-US 0409:00000409 en-US en-US en-US 0 true true Docker Windows for Docker VK7JG-NPHTM-C97JM-9MPGT-3V66T ``` -------------------------------- ### Windows 11 Disk Partitioning (UEFI + GPT) Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This XML configuration defines partitions for a UEFI-based Windows 11 installation on a GPT disk. It includes creating an EFI System Partition (ESP), a Microsoft Reserved Partition (MSR), and the main Windows partition, followed by formatting and assignment. ```xml 1 EFI 128 2 MSR 128 3 Primary true 1 1 FAT32 2 2 3 3 C NTFS ``` -------------------------------- ### High-Performance Windows Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/00-index.md Optimized Docker Compose configuration for high-performance Windows VMs. Specifies Windows version, RAM, CPU, disk size, and enables DHCP. Requires specific devices and capabilities for networking and virtualization. ```yaml services: windows: image: dockurr/windows environment: VERSION: "11" RAM_SIZE: "16G" CPU_CORES: "8" DISK_SIZE: "256G" DHCP: "Y" devices: - /dev/kvm - /dev/net/tun - /dev/vhost-net cap_add: - NET_ADMIN networks: vlan: ipv4_address: 192.168.0.100 volumes: - ./windows:/storage - ./shared:/shared ``` -------------------------------- ### Windows 7 Disk Partitioning (BIOS + MBR) Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This XML configuration outlines partition creation for a BIOS-based Windows 7 installation on an MBR disk. It includes creating a primary active partition, an extended partition, and a logical partition for the remaining space. ```xml 1 Primary 20480 true 2 Extended 3 Logical true ``` -------------------------------- ### Bypass Secure Boot Check in Windows Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This command bypasses the Secure Boot requirement during Windows setup. It's essential for virtual machine installations where Secure Boot might not be configured or supported. ```xml 2 reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f ``` -------------------------------- ### Bypass TPM 2.0 Check in Windows Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md Use this command to bypass the TPM 2.0 requirement during Windows setup in a VM. This registry modification is necessary for installing Windows 11 and later versions on virtual machines. ```xml 1 reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f ``` -------------------------------- ### Set Windows Language Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Configure the Windows language for installation and system UI using the LANGUAGE environment variable. This example sets it to French. ```yaml environment: LANGUAGE: "French" # or "fr" or "français" ``` -------------------------------- ### Dockur Windows Architecture Overview Source: https://github.com/dockur/windows/blob/master/_autodocs/01-project-overview.md This diagram illustrates the modular initialization chain of the Dockur Windows application, showing the sequence of shell scripts executed from the main entrypoint. ```shell entry.sh (main entrypoint) ├─ start.sh (startup hooks) ├─ utils.sh (utility functions) ├─ reset.sh (system initialization) ├─ server.sh (HTTP/VNC server) ├─ define.sh (Windows version definitions) ├─ mido.sh (ISO download) ├─ install.sh (Windows installation) ├─ disk.sh (disk initialization) ├─ display.sh (graphics/VNC setup) ├─ network.sh (networking) ├─ samba.sh (file sharing) ├─ boot.sh (boot configuration) ├─ proc.sh (CPU configuration) ├─ power.sh (shutdown handling) ├─ memory.sh (memory checks) ├─ balloon.sh (memory ballooning) ├─ config.sh (QEMU arguments) └─ finish.sh (finalization) ``` -------------------------------- ### Launch QEMU System Binary Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md This script launches the QEMU system binary with dynamically assembled arguments. It detects the QEMU version, creates a named pipe for output redirection, and executes QEMU, piping its output for filtering. ```bash cmd=(qemu-system-x86_64) version=$(${cmd[@]} --version | awk 'NR==1 { print $4 }') info "Booting ${APP}${BOOT_DESC} using QEMU v$version..." pipe="$QEMU_DIR/qemu.pipe" rm -f "$pipe" && mkfifo "$pipe" exec "${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" ``` -------------------------------- ### Disable Windows Firewall During Installation Source: https://github.com/dockur/windows/blob/master/_autodocs/06-networking-samba.md Disables the Windows Firewall during unattended installation to prevent network access issues. ```xml false ``` -------------------------------- ### Add Sound Support Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Integrate sound card emulation into the QEMU VM by adding Intel HD Audio and a duplex codec device. ```yaml environment: ARGUMENTS: "-device intel-hda -device hda-duplex" ``` -------------------------------- ### Enable Core11 or Nano11 Build Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Configure the environment to use a minimal Windows 11 build. Set the VERSION to 'core11' or 'nano11'. ```yaml environment: VERSION: "core11" # or "nano11" ``` -------------------------------- ### Modify Unattend.xml via OEM Script Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This method involves using an OEM installation script to modify the Unattend.xml file during installation. Ensure the script targets the correct registry keys and values. ```bash # In /oem/install.bat: reg add "HKLM\SYSTEM\CurrentControlSet\Services\..." /v ... ``` -------------------------------- ### Enable Nested Virtualization on Host (Intel) Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Enable nested virtualization for Intel processors by writing '1' to the 'nested' parameter of the kvm_intel module. Requires root privileges. ```bash # Intel echo 1 | sudo tee /sys/module/kvm_intel/parameters/nested ``` -------------------------------- ### QEMU Nested Virtualization Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Enables nested virtualization support by passing the 'nested=on' option to the CPU configuration. ```bash ARGUMENTS="-cpu host,nested=on" ``` -------------------------------- ### Macvlan Network Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Enables isolated IP addresses for containers, requiring further setup detailed in networking.md. ```yaml services: windows: # Macvlan network configuration would go here, refer to networking.md ``` -------------------------------- ### QEMU CPU Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Configures the number of virtual CPU cores and the CPU model. '-cpu host' enables CPU model passthrough. ```bash -smp cores=4 ``` ```bash -cpu host,+x2apic ``` -------------------------------- ### QEMU Display Configuration (VNC) Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Configures a VNC server for remote graphical access. The port is mapped to HTTP via a web server. ```bash -vnc :1 ``` ```bash -display vnc=:0 ``` -------------------------------- ### Set Windows USERNAME Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Defines the username for the Windows user account created during installation. Standard Windows username rules apply. ```yaml environment: USERNAME: "admin" USERNAME: "user123" ``` -------------------------------- ### QEMU Memory Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Sets the guest RAM size in megabytes. The system validates that guest RAM does not exceed available host RAM. ```bash -m 8192 ``` -------------------------------- ### Enable QEMU Monitor Console Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Enable an interactive QEMU monitor console for debugging. Note that this can interfere with normal VM boot. ```yaml environment: ARGUMENTS: "-monitor stdio" ``` -------------------------------- ### Set Windows PASSWORD Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Sets the password for the user account created during installation. Ensure it meets Windows password requirements if enforcement is enabled. ```yaml environment: PASSWORD: "MySecurePassword123!" ``` -------------------------------- ### Check Guest Memory Usage (QEMU Monitor) Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md If the QEMU monitor console is available, use the 'info balloon' command to check the current balloon status of the guest. This provides insights into memory reclamation. ```bash # If monitor console available info balloon ``` -------------------------------- ### Custom Bridge Network Setup Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Defines a custom bridge network with a specific subnet and gateway, then assigns a static IP to the container within that network. ```yaml networks: windows-net: driver: bridge ipam: config: - subnet: 172.20.0.0/16 gateway: 172.20.0.1 services: windows: networks: windows-net: ipv4_address: 172.20.0.10 ``` -------------------------------- ### QEMU Graphics Adapter Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Specifies the graphics adapter for the virtual machine. VirtIO GPU offers higher performance. ```bash -vga qxl ``` ```bash -device virtio-gpu-pci ``` -------------------------------- ### Docker Compose Management Source: https://github.com/dockur/windows/blob/master/_autodocs/00-index.md Manage the Windows container using Docker Compose. Includes commands for starting, viewing logs, accessing the shell, and stopping the container. ```bash docker-compose up -d docker logs -f windows # View logs docker exec -it windows bash # Shell access docker-compose down # Stop ``` -------------------------------- ### Specify Keyboard Layout and Region Source: https://github.com/dockur/windows/blob/master/readme.md Configure the keyboard layout and region for the Windows installation using the KEYBOARD and REGION environment variables. This is useful for non-default layouts. ```yaml environment: REGION: "en-US" KEYBOARD: "en-US" ``` -------------------------------- ### Build Multi-Arch Docker Image with BuildKit Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Builds a multi-architecture Docker image (amd64 and arm64) using BuildKit, tags it, and pushes it to a registry. Requires BuildKit enabled and Docker Hub credentials configured if pushing to a private repository. ```bash docker buildx build --platform linux/amd64,linux/arm64 \ -t myuser/windows:latest \ --push . ``` -------------------------------- ### Change Storage Location Source: https://github.com/dockur/windows/blob/master/readme.md Use a volumes bind mount to specify a custom storage location for the Windows installation. Replace './windows' with your desired path or named volume. ```yaml volumes: - ./windows:/storage ``` -------------------------------- ### QEMU VirtIO Disk Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Configures a VirtIO block device for high-performance storage using QCOW2 format. ```bash -drive if=virtio,id=drv0,format=qcow2,file=/storage/disk0.qcow2 ``` ```bash -device virtio-blk-pci,drive=drv0 ``` -------------------------------- ### Add SATA Disk Controller with IDE Emulation Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Configure QEMU to add a SATA disk controller that emulates an IDE interface by setting the ARGUMENTS environment variable. ```yaml environment: ARGUMENTS: "-device ahci,id=ahci0" ``` -------------------------------- ### QEMU Machine Type Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Specifies the machine architecture and acceleration method. Attempts KVM first, falling back to TCG if unavailable. ```bash -machine type=pc,accel=kvm ``` -------------------------------- ### Enable Tiny11 or Tiny10 Build Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Configure the environment to use a specialized, streamlined Windows build. Set the VERSION to 'tiny11' or 'tiny10'. ```yaml environment: VERSION: "tiny11" # or "tiny10" ``` -------------------------------- ### Get Language Details Source: https://github.com/dockur/windows/blob/master/_autodocs/03-version-system.md Retrieves specific details about a language based on its code or name. Supports returning the description, full name, ISO code, or BCP 47 culture code. ```bash getLanguage() { local id="$1" # Language code (e.g., "en", "de", "fr") local ret="$2" # Return type: "desc", "name", "code", "culture" } ``` ```bash getLanguage "en" "culture" # Returns: "en-US" getLanguage "de" "name" # Returns: "German" getLanguage "français" "code" # Returns: "fr" ``` -------------------------------- ### QEMU Disk Pass-through Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Configures direct pass-through of a physical disk device using VirtIO SCSI. ```bash -drive if=none,id=passthrough,file=/dev/sdb,format=raw ``` ```bash -device virtio-scsi-pci ``` ```bash -device scsi-hd,drive=passthrough ``` -------------------------------- ### Enable QEMU Guest Agent Communication Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Configure QEMU arguments to establish communication with the QEMU Guest Agent running in the Windows guest. This enables features like graceful shutdown and snapshots. ```yaml environment: ARGUMENTS: "-device virtio-serial -chardev socket,path=/var/run/qga.sock,server,nowait,id=qga0 -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0" ``` -------------------------------- ### Get Complete Internal Version Identifier with Edition Source: https://github.com/dockur/windows/blob/master/_autodocs/03-version-system.md Maps a full Windows display name, including the edition, and architecture to a complete internal version identifier. Use this for detailed version identification. ```bash getVersion() { local name="$1" # Windows full display name local arch="$2" # Architecture } ``` ```bash getVersion "Windows 11 Enterprise Evaluation" "x64" # Returns: "win11x64-enterprise-eval" ``` ```bash getVersion "Windows Server 2022" "x64" # Returns: "win2022x64-eval" ``` -------------------------------- ### Pass-through USB Device in Compose File Source: https://github.com/dockur/windows/blob/master/readme.md Configure your compose file to pass through a USB device by specifying its vendor and product IDs. Ensure the device is not connected during initial Windows Setup to avoid data loss. ```yaml environment: ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x1234" devices: - /dev/bus/usb ``` -------------------------------- ### Check Container Logs Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md View the first 50 lines of a container's logs to identify startup errors or other issues. ```bash docker logs | head -50 ``` -------------------------------- ### Enable IOMMU for Passthrough Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Activate IOMMU support in QEMU, which is essential for device passthrough capabilities. ```yaml environment: ARGUMENTS: "-machine iommu=on" ``` -------------------------------- ### Use VirtIO GPU Adapter Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Enable the VirtIO GPU adapter for potentially better performance and newer features. This requires passing specific arguments to QEMU. ```yaml environment: ARGUMENTS: "-device virtio-gpu-pci,max_outputs=1" ``` -------------------------------- ### Check CPU Virtualization Support Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Verify if the host CPU supports Intel VT-x (vmx) virtualization extensions, required for KVM. ```bash grep vmx /proc/cpuinfo ``` -------------------------------- ### Extracting OEM Key from ISO Metadata Source: https://github.com/dockur/windows/blob/master/_autodocs/05-installation-system.md This bash script snippet demonstrates how to extract an OEM product key from ISO file metadata for legacy Windows versions. It involves finding the PID.INF file and parsing it to get the key. ```bash # Read PID.INF from ISO file=$(find "$target" -maxdepth 1 -type f -iname PID.INF -print -quit) # Extract OEM key key="${pid:$((${#pid})) - 8:5}" ``` -------------------------------- ### Update Docker Container Without Data Loss Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md This procedure outlines how to update a Docker container while ensuring that all persistent data is retained. It involves stopping the old container, pulling the new image, and then starting a new container with the same persistent volume. ```yaml volumes: - ./windows:/storage # Persistent ``` ```bash docker-compose down ``` ```bash docker-compose pull ``` ```bash docker-compose up -d ``` -------------------------------- ### Configure Shared Folder Source: https://github.com/dockur/windows/blob/master/readme.md Use a volumes bind mount to designate a host folder that will appear as the 'Shared' folder on the Windows desktop for file exchange. Replace './example' with your desired host path. ```yaml volumes: - ./example:/shared ``` -------------------------------- ### Enable Nested Virtualization on Host (AMD) Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Enable nested virtualization for AMD processors by writing '1' to the 'nested' parameter of the kvm_amd module. Requires root privileges. ```bash # AMD echo 1 | sudo tee /sys/module/kvm_amd/parameters/nested ``` -------------------------------- ### Configure Docker Log Rotation Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Configure log rotation settings in the Docker daemon's `daemon.json` file to manage log file size and quantity. This example limits individual log files to 100MB and keeps a maximum of 3 files. ```json { "log-driver": "json-file", "log-opts": { "max-size": "100m", "max-file": "3" } } ``` -------------------------------- ### Check Host CPU for Nested Virtualization Support (Intel) Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Verify if the host CPU supports nested virtualization for Intel processors by checking the 'nested' parameter in the kvm_intel module. ```bash # Intel cat /sys/module/kvm_intel/parameters/nested ``` -------------------------------- ### QEMU VGA Adapter Configuration for Resolution Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Configure the VGA adapter in QEMU. The resolution is primarily handled by the Windows guest, with RDP negotiating the final display size. ```bash -vga qxl # Resolution handled by Windows guest; RDP negotiates final size ``` -------------------------------- ### Configure Docker Health Check for Web Server Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Sets up a Docker health check to monitor the availability of a web server, which can serve as an indicator of the system's overall health. Includes parameters for test command, interval, timeout, retries, and start period. ```yaml services: windows: healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8006/"] interval: 30s timeout: 10s retries: 3 start_period: 300s # Wait 5 minutes for boot ``` -------------------------------- ### Base Dockerfile Stage for AMD64 Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md This Dockerfile stage uses a scratch base image and copies QEMU to support the amd64 architecture. It serves as the foundation for building the primary image. ```dockerfile FROM scratch AS build-amd64 COPY --from=qemux/qemu:7.32 / / ``` -------------------------------- ### Configure VNC Resolution via Environment Variables Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Set the desired WIDTH and HEIGHT for the VNC display server using environment variables. Defaults are 1024x768 if not specified. ```yaml environment: WIDTH: "1920" HEIGHT: "1080" ``` -------------------------------- ### RDP Access from macOS Source: https://github.com/dockur/windows/blob/master/_autodocs/06-networking-samba.md Initiate an RDP connection to localhost using the 'open' command with an rdp URL scheme. ```bash open rdp://localhost:3389 ``` -------------------------------- ### Configure Secondary Disk Sizes and Mounts Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Creates additional secondary disks (D:, E:, etc.) with specified sizes and maps them to volume mounts. These are configured during container initialization. ```yaml environment: DISK2_SIZE: "32G" DISK3_SIZE: "64G" volumes: - ./storage2:/storage2 - ./storage3:/storage3 ``` -------------------------------- ### Pre-allocate Disk Space for QCOW2 Image Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Creates a QCOW2 disk image with pre-allocated space to prevent fragmentation. This is useful for ensuring consistent disk performance. ```bash # In /run/disk.sh or manually: qemu-img create -f qcow2 -o preallocation=full disk.qcow2 64G ``` -------------------------------- ### Provide Windows Product KEY Source: https://github.com/dockur/windows/blob/master/_autodocs/02-configuration-reference.md Specifies the Windows product key for activation. If not provided, embedded trial keys from the image metadata are used. ```yaml environment: KEY: "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" ``` -------------------------------- ### QEMU VirtIO Driver Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Enables VirtIO drivers for SCSI and network devices, offering improved performance over legacy drivers. ```bash -device virtio-scsi-pci,id=scsi0 ``` ```bash -device scsi-hd,drive=disk0 ``` ```bash -device virtio-net-pci,netdev=net0 ``` -------------------------------- ### Configure QEMU for io_uring Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md To utilize io_uring for I/O optimization with QEMU 5.0+, configure the drive arguments with `aio=io_uring`. This requires the VirtIO block driver. ```bash ARGUMENTS="-drive if=none,id=disk0,file=/storage/disk0.qcow2,aio=io_uring" ``` -------------------------------- ### Monitor Host Performance Source: https://github.com/dockur/windows/blob/master/_autodocs/08-docker-deployment.md Check host system resources including CPU usage, memory, and disk I/O to identify performance bottlenecks. ```bash top -b -n 1 ``` ```bash iostat -x 1 5 ``` -------------------------------- ### Enable Verbose QEMU Logging Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Configure QEMU to create a detailed debug log file. This is useful for diagnosing complex issues. ```yaml environment: ARGUMENTS: "-d all -D /tmp/qemu.log" ``` -------------------------------- ### Check Host CPU for Nested Virtualization Support (AMD) Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Verify if the host CPU supports nested virtualization for AMD processors by checking the 'nested' parameter in the kvm_amd module. ```bash # AMD cat /sys/module/kvm_amd/parameters/nested ``` -------------------------------- ### Configure Container for Multiple USB Devices Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md To pass multiple USB devices, append additional `-device usb-host` arguments to the `ARGUMENTS` environment variable, each with unique vendor and product IDs. ```yaml environment: ARGUMENTS: "-device usb-host,vendorid=0x1234,productid=0x5678 -device usb-host,vendorid=0xabcd,productid=0xef01" ``` -------------------------------- ### Print Formatted Windows Version Source: https://github.com/dockur/windows/blob/master/_autodocs/03-version-system.md Converts internal Windows version identifiers into human-readable display names. Use this to show user-friendly version strings. ```bash printVersion() { local id="$1" # Internal version identifier local desc="$2" # Display description (if version not recognized) } ``` ```bash printVersion "win11x64" "" # Returns: "Windows 11" printVersion "win10x64-ltsc" "" # Returns: "Windows 10" printVersion "win2022-eval" "" # Returns: "Windows Server 2022" printVersion "win7x64-ultimate" "" # Returns: "Windows 7" ``` -------------------------------- ### QEMU BIOS/Firmware Configuration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Specifies the BIOS or UEFI firmware for the virtual machine. OVMF is used for UEFI boot with Windows 8+. ```bash -bios /usr/share/qemu/bios.bin ``` ```bash -pflash firmware.rom ``` -------------------------------- ### Use Local ISO File Source: https://github.com/dockur/windows/blob/master/readme.md Bind a local ISO file using the volumes directive to use it instead of downloading. The VERSION environment variable will be ignored. ```yaml volumes: - ./example.iso:/boot.iso ``` -------------------------------- ### Enable KVM Acceleration Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md To enable KVM acceleration, ensure that the /dev/kvm device is available and readable. This is crucial for QEMU performance, as it avoids the much slower TCG fallback. ```yaml devices: - /dev/kvm ``` -------------------------------- ### QEMU Display Configuration (Nographic) Source: https://github.com/dockur/windows/blob/master/_autodocs/04-qemu-configuration.md Disables graphical display, enabling text-only console access. ```bash -nographic ``` -------------------------------- ### RDP Access from Linux Source: https://github.com/dockur/windows/blob/master/_autodocs/06-networking-samba.md Connect to the RDP service running on localhost using the rdesktop client. ```bash rdesktop localhost:3389 ``` -------------------------------- ### Identify Host Disk Source: https://github.com/dockur/windows/blob/master/_autodocs/07-special-features.md Use `lsblk` to identify available physical disks and partitions on the host system before configuring pass-through. ```bash lsblk # sdb 8:16 0 100G 0 disk # sdc 8:32 0 200G 0 disk ``` -------------------------------- ### Print Windows Version with Edition Source: https://github.com/dockur/windows/blob/master/_autodocs/03-version-system.md Appends the specific edition (e.g., Pro, Enterprise, Ultimate) to a Windows version string. Useful for displaying a complete version and edition. ```bash printEdition() { local id="$1" # Internal version identifier local desc="$2" # Display description } ``` ```bash printEdition "win11x64" "" # Returns: "Windows 11 Pro" printEdition "win10x64-enterprise-eval" "" # Returns: "Windows 10 Enterprise (Evaluation)" printEdition "win7x64-ultimate" "" # Returns: "Windows 7 Ultimate" ```