Running Windows in Docker: Complete Guide and Best Practices
Introduction
Ever wondered if you could run a full Windows system inside a Docker container? What once seemed impossible is now a reality thanks to dockur/windows, a groundbreaking solution that lets you run Windows 11, 10, and even classic Windows 7 smoothly within Docker containers.
This guide will walk you through the process of achieving this seemingly impossible task, transforming your Docker container into a fully functional Windows workstation.
๐ก If youโre interested in running Windows in Docker, this tutorial will guide you step by step through the process.
Why Run Windows in Docker?
Before diving into the technical details, letโs understand the benefits of running Windows in Docker:
- ๐ Rapid deployment and migration
- ๐พ Lower resource overhead
- ๐ Multiple version coexistence
- ๐ ๏ธ Simplified environment management
- ๐ Enhanced isolation
dockur/windows Features Overview
dockur/windows offers these core capabilities:
- โจ Support for multiple Windows versions (11/10/8.1/7/XP and more)
- ๐ Automatic ISO downloading
- โก KVM acceleration support
- ๐ Web-based remote access
- ๐ฅ๏ธ RDP remote desktop support
- ๐ฝ Flexible storage configuration
- โ๏ธ Customizable CPU and memory allocation
- ๐ช ARM version support Check ARM version here
System Requirements
Before starting, ensure your system meets these prerequisites:
๐ก If youโre testing in VirtualBox, remember to enable virtualization support first.
Requirement | Minimum | Recommended |
---|---|---|
OS | Linux (KVM support) | Ubuntu 22.04+ |
CPU | Virtualization capable | 4+ cores |
Memory | 4GB | 8GB+ |
Storage | 20GB free space | SSD storage |
Basic Installation and Configuration
1. Deploy with Docker Compose
Create a compose.yml
file:
services:
windows:
image: dockurr/windows
container_name: windows
environment:
VERSION: "11" # Choose Windows version
devices:
- /dev/kvm # KVM device mapping
cap_add:
- NET_ADMIN
ports:
- 8006:8006 # Web access port
- 3389:3389/tcp # RDP ports
- 3389:3389/udp
volumes:
- /home/vir-docker/data:/storage # Windows image will be created on your local drive
stop_grace_period: 2m # Grace period for clean shutdown
๐ก Graceful shutdown enabled
2. Launch the Container
docker-compose up -d
System Configuration Guide
Windows Version Selection
Choose different Windows versions by setting the VERSION
environment variable:
Code | Version | Image Size |
---|---|---|
11 | Windows 11 Pro | 5.4 GB |
11l | Windows 11 LTSC | 4.2 GB |
11e | Windows 11 Enterprise | 5.8 GB |
10 | Windows 10 Pro | 5.7 GB |
10l | Windows 10 LTSC | 4.6 GB |
10e | Windows 10 Enterprise | 5.2 GB |
8 | Windows 8.1 Pro | 4.0 GB |
8e | Windows 8.1 Enterprise | 3.7 GB |
7e | Windows 7 Enterprise | 3.0 GB |
ve | Windows Vista Enterprise | 3.0 GB |
xp | Windows XP Professional | 0.6 GB |
2025 | Windows Server 2025 | 5.0 GB |
2022 | Windows Server 2022 | 4.7 GB |
2019 | Windows Server 2019 | 5.3 GB |
2016 | Windows Server 2016 | 6.5 GB |
2012 | Windows Server 2012 | 4.3 GB |
2008 | Windows Server 2008 | 3.0 GB |
2003 | Windows Server 2003 | 0.6 GB |
Storage Configuration
Modify default storage location:
volumes:
- /var/win:/storage # Custom storage path
Adjust disk sizes:
environment:
DISK_SIZE: "256G" # Primary disk size
DISK2_SIZE: "32G" # Secondary disk size
DISK3_SIZE: "64G" # Third disk size
volumes:
- /var/win:/storage # Primary disk path
- /home/win:/storage2 # Secondary disk path
- /mnt/win:/storage3 # Third disk path
System Resource Allocation
Configure CPU and memory:
environment:
RAM_SIZE: "8G" # Allocate 8GB RAM
CPU_CORES: "4" # Allocate 4 CPU cores
Language Customization
By default, Windows installs in English. Set a different language using the LANGUAGE
environment variable:
environment:
LANGUAGE: "English" # Set Windows language
Supported languages include:
Language | Setting | Language | Setting |
---|---|---|---|
English | English | Chinese | Chinese |
Japanese | Japanese | Korean | Korean |
French | French | German | German |
Spanish | Spanish | Russian | Russian |
Italian | Italian | Portuguese | Portuguese |
๐ก Tip: Choose officially supported languages for best stability and compatibility.
Remote Access Setup
Web Access
- Access
http://your-host-ip:8006
after container launch - Wait for automatic installation
- Installation is complete when Windows desktop appears
RDP Remote Desktop
- Connect using any RDP client to
your-host-ip:3389
- Default username:
Docker
- Default password: none
Custom Credentials
environment:
USERNAME: "admin"
PASSWORD: "secure_password"
Advanced Configuration
Custom Installation Scripts
Create and mount install.bat
:
volumes:
- /path/to/scripts:/oem
DHCP Network Configuration
Enable DHCP:
environment:
DHCP: "Y"
devices:
- /dev/vhost-net
device_cgroup_rules:
- 'c *:* rwm'
Troubleshooting
KVM Support Verification
Check KVM support:
sudo apt install cpu-checker
sudo kvm-ok
Performance Optimization Tips
- Enable CPU virtualization extensions
- Use SSD storage
- Allocate sufficient system resources
- Consider macvlan networking for better performance
Conclusion
dockur/windows provides a powerful and flexible solution for running Windows systems in Docker containers. This guide enables you to easily deploy and manage Windows in Docker, opening new possibilities for development, testing, and virtualization scenarios.