# Running Classic Windows Games with Docker **The Challenge:** You want to play classic Windows 95/98 games like The Sims 1, Microsoft Encarta, and Adi on your modern Apple Silicon Mac using Docker Desktop. **The Solution:** Use a Docker container running Windows 95/98 in a browser-based emulator. Understanding how this works on Apple Silicon helps you set realistic performance expectations. ## Understanding the Architecture on Apple Silicon Before diving into setup, it's important to understand what's happening under the hood when you run Windows 98 games on your M-series Mac. ### The Virtualization Stack Your Apple Silicon Mac runs on **ARM64 architecture**, but Windows 98 was built for **x86 (Intel) architecture**. Here's what happens: ``` ┌─────────────────────────────────────────┐ │ Your Apple Silicon Mac (ARM64) │ │ macOS with M1/M2/M3/M4 chip │ └─────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────┐ │ Docker Desktop │ │ (uses Docker VMM or Apple │ │ Virtualization Framework) │ └─────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────┐ │ Linux VM (ARM64 or x86_64 emulated) │ │ - Docker Engine runs here │ │ - Uses QEMU for x86 emulation │ └─────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────┐ │ Windows 98 Container (x86) │ │ - QEMU emulates x86 CPU │ │ - Your games run here │ └─────────────────────────────────────────┘ ``` ### What Each Layer Does **Layer 1: macOS on Apple Silicon** - Your M-series chip is ARM-based, fundamentally different from Intel x86 - macOS provides virtualization frameworks that Docker uses **Layer 2: Docker Desktop's VM** - Docker containers need a Linux kernel to run - Docker Desktop creates a lightweight Linux VM using either: - **Docker VMM** (fastest option for Apple Silicon, requires Docker Desktop 4.35+) - **Apple Virtualization Framework** (stable, widely compatible) - **QEMU** (deprecated, slower) **Layer 3: Linux VM with QEMU** - The Linux VM runs Docker Engine - QEMU handles x86 emulation when you run x86 containers - QEMU translates x86 instructions into ARM64 instructions your Mac can understand **Layer 4: Windows 98 Container** - The container itself runs Windows 98 (x86) - Windows 98 was designed for Intel processors, so QEMU is doing heavy lifting here - Your games run inside this emulated Windows environment ### What is QEMU? (The Key Component) **QEMU** (Quick Emulator) is the critical piece that makes this all work. Think of it as a universal translator for computer processors. **What QEMU does:** - **CPU emulation:** Pretends to be an Intel x86 processor, even though your Mac has an ARM processor - **Hardware simulation:** Creates virtual versions of graphics cards, sound cards, hard drives, CD-ROM drives, etc. - **Instruction translation:** Takes x86 machine code (Intel instructions) and translates it into ARM64 code (Apple Silicon instructions) on the fly **How QEMU works - simplified analogy:** Imagine Windows 98 only speaks Italian, but your Apple Silicon Mac only understands Japanese: ``` Windows 98 game: "Hey Intel CPU, add 5 + 3!" ↓ QEMU (translator): "I heard that. Let me translate..." ↓ QEMU to Mac: "Execute ARM64 addition: 5 + 3" ↓ Mac executes: Actually does the math (gets 8) ↓ QEMU: "Got it! Translating result back..." ↓ Windows 98 game: Receives "8" and thinks it talked to a real Intel CPU ``` This translation happens **millions of times per second** for every instruction your game runs. **Two ways QEMU can work:** 1. **With hardware acceleration (KVM on Linux):** - Like having a simultaneous interpreter with instant translation tools - The host CPU helps with the translation using special hardware features - Result: ~90-95% of native speed 2. **Pure software emulation (TCG on Apple Silicon):** - Like manually translating every sentence word-by-word from a dictionary - QEMU's "Tiny Code Generator" (TCG) does all the work in software - Result: ~20-40% of native speed ### What is KVM? (Why Linux is Faster) **KVM** (Kernel-based Virtual Machine) is what makes virtualization incredibly fast on Linux. It's the reason why running Windows games on Linux with Docker is so much faster than on a Mac. **What KVM is:** - A **Linux kernel module** - it's built directly into Linux as part of the operating system - Turns Linux into a **hypervisor** (a system that can run virtual machines efficiently) - Relies on **hardware virtualization extensions** built into modern CPUs **The hardware magic - CPU virtualization extensions:** Modern Intel and AMD processors have special features specifically designed for virtualization: - **Intel calls theirs: VT-x** (Virtualization Technology) - **AMD calls theirs: AMD-V** (AMD Virtualization) These are physical circuits in your CPU that help run virtual machines faster. Think of them as a "turbo mode" specifically for virtualization. **How KVM uses these hardware features:** Without KVM (pure QEMU on Apple Silicon): ``` x86 instruction → QEMU translates to ARM64 → Mac CPU executes (Slow: every instruction must be translated) ``` With KVM on x86 Linux: ``` x86 instruction → CPU's VT-x/AMD-V directly executes it (Fast: CPU runs it natively with hardware help) ``` **Real-world analogy:** Imagine you need to run a Windows program: **Apple Silicon (no KVM):** - Your ARM CPU is like a Japanese speaker - Windows program speaks Italian (x86) - QEMU must manually translate every sentence from Italian to Japanese - Slow but works **Linux with KVM (x86 CPU):** - Your Intel/AMD CPU is like an Italian speaker - Windows program speaks Italian (x86) - KVM lets the CPU speak directly - almost no translation needed! - The CPU's VT-x/AMD-V features are like having perfect Italian grammar skills - Fast and efficient **Why can't Apple Silicon use KVM?** KVM requires **matching architectures:** - ✅ x86 Linux + KVM + x86 Windows = Fast (same language family) - ✅ ARM Linux + KVM + ARM Windows = Fast (same language family) - ❌ ARM Mac + KVM + x86 Windows = **Impossible** (completely different languages) Your M-series Mac has its own virtualization hardware (Apple's Virtualization Framework), but it only speeds up ARM guests. Since Windows 98 is x86, there's no hardware shortcut available. **The /dev/kvm device:** On Linux, KVM is accessed through a special file called `/dev/kvm`. When Docker containers use `--device=/dev/kvm`, they're saying "please give me access to the CPU's hardware virtualization features." On Mac, this file doesn't exist because: 1. macOS isn't Linux (no KVM kernel module) 2. Even if it did exist, ARM hardware can't accelerate x86 guests **The bottom line:** - **KVM = Hardware-accelerated virtualization for matching architectures** - **Available on Linux with Intel/AMD CPUs (or ARM CPUs running ARM guests)** - **Not available on Mac for x86 Windows (architecture mismatch)** - **This is why you'd get 3-5x better performance on Linux** Even though QEMU is doing pure software emulation on your Mac, your M-series Mac is so powerful that it can still emulate a 233 MHz Pentium II at playable speeds. A 1998 computer had about 0.0002% of your Mac's processing power, so there's plenty of headroom even after QEMU's translation overhead. ### Performance Reality Check **The good news:** - Modern Apple Silicon is incredibly fast - even with emulation overhead, it's usable - Windows 98 games are not demanding by today's standards (they ran on 233 MHz Pentium II CPUs!) - QEMU's x86 emulation has improved significantly **The challenges:** - **Multiple emulation layers:** You're emulating x86 on ARM64, then running Windows inside that - **No hardware acceleration:** Unlike Linux hosts with KVM, there's no direct hardware virtualization for x86 guests on ARM - **Performance penalty:** Expect 20-40% of what you'd get on native x86 hardware or Linux with KVM **Comparison:** - **Native x86 Linux + KVM:** ~90-95% native performance (hardware-accelerated) - **Apple Silicon + QEMU:** ~20-40% of x86 performance (software emulation) - **Rosetta 2 (for native Mac apps):** ~80% of native x86 performance ### Why Not Use Rosetta 2? You might wonder: "macOS has Rosetta 2 for running x86 apps - why can't Docker use that?" **The answer:** Rosetta 2 works for macOS applications, but: - Docker containers run Linux (not macOS), so Rosetta doesn't apply - Windows 98 is neither macOS nor Linux - You need QEMU for full system emulation, not just app translation Docker Desktop *does* support Rosetta 2 for Linux x86_64 binaries (see Settings > Features in development), but this doesn't help with full Windows emulation. ### When Performance Matters **Games that will work fine:** - Turn-based games (The Sims 1, SimCity) - Adventure games (Myst, point-and-click games) - Educational software (Encarta, Adi) - Strategy games (Age of Empires, StarCraft) **Games that might struggle:** - Fast-paced 3D action games - Games with intense graphics rendering - Games that relied on specific hardware (3dfx cards, etc.) ## What You Need Before starting: - ✅ Apple Silicon Mac (M1, M2, M3, or M4) - ✅ Docker Desktop installed and running (version 4.35+ recommended for Docker VMM) - ✅ Game installation files (ISOs, CD images, or installer directories) - ✅ About 2-4 GB free disk space per Windows installation - ✅ Basic terminal comfort - ✅ Realistic performance expectations (games will be slower than on native x86) ## Approach 1: Browser-Based Windows 95/98 (Easiest) This approach runs a full Windows 95 or 98 environment in your browser using Docker. ### Using the `dockur/windows` Container The `dockur/windows` project supports running various Windows versions including 95 and 98: ```bash # Run Windows 98 in Docker docker run -d \ --name windows98 \ -p 8006:8006 \ -e VERSION="98" \ --device=/dev/kvm \ --cap-add NET_ADMIN \ dockur/windows ``` **Access it:** Open `http://localhost:8006` in your browser **What happens:** 1. Container downloads Windows 98 installation media 2. Installs Windows in the container 3. Provides VNC-based browser access 4. You interact with a full Windows 98 desktop ### Installing Your Games Once Windows is running: 1. **Mount a games folder** to make your game files accessible: ```bash docker run -d \ --name windows98 \ -p 8006:8006 \ -e VERSION="98" \ -v ~/Games:/data \ --device=/dev/kvm \ --cap-add NET_ADMIN \ dockur/windows ``` 2. **Access the browser interface** at `http://localhost:8006` 3. **Copy game installers** from `/data` (your `~/Games` folder) to the Windows desktop 4. **Run installers** just like you would on a real Windows 98 machine ### For Specific Games **The Sims 1:** - Requires DirectX 7 or 8 (often included on game disc) - Install from CD image or mounted ISO - May need to apply no-CD patch for convenience **Microsoft Encarta:** - Usually runs well in Windows 98 - Mount the CD ISO and run setup - Multimedia features work great **Adi Educational Software:** - Very compatible with Windows 95/98 - Install from CD or installer directory - Usually runs without issues ## Approach 2: Wine-Based Containers (For Specific Games) Wine runs Windows applications directly on Linux/Mac without full Windows installation. ### Using `scottyhardy/docker-wine` ```bash # Pull the container docker pull scottyhardy/docker-wine # Run with GUI support (X11) docker run -it \ --rm \ --hostname="$(hostname)" \ -e DISPLAY=host.docker.internal:0 \ -v ~/Games:/data \ scottyhardy/docker-wine wine /data/Sims1/Sims.exe ``` **Note:** This requires X11 forwarding setup on Mac (using XQuartz), which adds complexity. ## Approach 3: DOSBox-X for DOS/Early Windows Games For older games that ran on DOS or Windows 3.1: ```bash docker run -it \ -v ~/Games:/games \ -p 5900:5900 \ jgoerzen/dosbox-x ``` Connect via VNC viewer to `localhost:5900` ## Recommended Workflow for Your Use Case **For The Sims 1, Encarta, and Adi, I recommend Approach 1 (browser-based Windows 98):** ### Step-by-Step Setup 1. **Create a games directory:** ```bash mkdir -p ~/RetroGames/ISOs ``` 2. **Place your game files** in `~/RetroGames/ISOs/` 3. **Run the Windows 98 container:** ```bash docker run -d \ --name win98gaming \ -p 8006:8006 \ -e VERSION="98" \ -v ~/RetroGames:/data \ --device=/dev/kvm \ --cap-add NET_ADMIN \ dockur/windows ``` 4. **Wait for installation** (15-20 minutes first time) 5. **Access Windows 98** at `http://localhost:8006` 6. **Install games** from `/data` folder ### Managing the Container ```bash # Stop Windows 98 docker stop win98gaming # Start it again docker start win98gaming # Remove completely (keeps your games in ~/RetroGames) docker rm win98gaming # View logs if something goes wrong docker logs win98gaming ``` ## Apple Silicon Optimizations ### Removing Unnecessary Flags **Important:** The `--device=/dev/kvm` flag in the examples above is for Linux KVM hardware acceleration. It **won't work on Mac** and should be removed: **For Apple Silicon, use this command:** ```bash docker run -d \ --name win98gaming \ -p 8006:8006 \ -e VERSION="98" \ -v ~/RetroGames:/data \ --cap-add NET_ADMIN \ dockur/windows ``` ### Enabling Docker VMM (Recommended for M-series Macs) Docker VMM provides better performance on Apple Silicon. To enable it: 1. Open **Docker Desktop** 2. Go to **Settings** (gear icon) 3. Navigate to **General** > **Virtual Machine Manager** 4. Select **Docker VMM** (requires Docker Desktop 4.35+) 5. Go to **Resources** tab 6. Increase memory to at least **4 GB** (Docker VMM requirement) 7. Click **Apply & Restart** **Performance improvement:** Docker VMM can provide 2x faster file I/O compared to Apple Virtualization Framework, which helps with game loading and installation. ### Checking Your Setup Verify what virtualization Docker is using: ```bash # Check Docker Desktop version docker --version # View Docker system info docker info | grep -i "operating system" ``` ### Platform-Specific Considerations When running the `dockur/windows` container on Apple Silicon: - **QEMU is unavoidable:** The container uses QEMU to emulate x86, regardless of your Docker VMM choice - **ARM64 vs x86_64:** Some Docker images come in both architectures - Windows 98 containers are always x86 - **Multi-platform images:** If available, ARM64 images run much faster (but Windows 98 isn't available for ARM) ## Troubleshooting **Container won't start:** - Check Docker Desktop is running - Try removing `--device=/dev/kvm` on Mac - Check port 8006 isn't already in use: `lsof -i :8006` **Can't access http://localhost:8006:** - Wait 15-20 minutes for first-time Windows installation - Check container logs: `docker logs win98gaming` - Try accessing via your machine's IP instead of localhost **Games won't install:** - Verify game files are in mounted directory (`~/RetroGames`) - Check file permissions: `ls -la ~/RetroGames` - Try copying files to Windows desktop first, then installing **Performance is slow:** - This is expected on Apple Silicon (QEMU x86 emulation overhead) - **Enable Docker VMM** in Settings > General for better performance - **Increase Docker memory** to 4-6 GB in Settings > Resources - Reduce screen resolution in Windows 98 (640×480 or 800×600) - Close other Docker containers and resource-intensive apps - Try disabling 3D graphics options in games if available **Emulation errors or crashes:** - Some games may have compatibility issues with QEMU's x86 emulation - Check container logs: `docker logs win98gaming` - Try Windows 95 instead: `-e VERSION="95"` (sometimes more stable) - Look for no-CD patches if games require CD checks ## Why This Approach Works (Despite the Complexity) Even though we're going through multiple emulation layers, this Docker approach has real advantages: ### Benefits **Isolation and Safety** - Windows 95/98 runs in a completely isolated container - Your Mac remains unaffected by old software or malware - Easy to reset/reinstall if something breaks: just remove the container and start fresh **Convenience** - **Browser-based access:** No VNC client needed - use Safari or Chrome - **No native Windows license needed:** The container handles Windows installation - **Works on modern hardware:** Play old games without maintaining old computers **Flexibility** - Run multiple Windows versions simultaneously (Windows 95, 98, even XP) - Each version on a different port: `localhost:8006`, `localhost:8007`, etc. - Easy to snapshot/backup: `docker commit` saves your container state **Reproducibility** - Same setup works on any Mac with Docker Desktop - Share exact game environments with friends (via container exports) - Perfect for preservation of classic software ### The Performance Trade-Off **What you're trading:** - Performance (games run slower than on native x86) - Some compatibility (QEMU emulation isn't perfect) **What you're gaining:** - Ability to play these games at all on Apple Silicon - Modern macOS security and stability - Easy management and cleanup - No need for old hardware **Bottom line:** For turn-based games, educational software, and classic adventures, the performance is totally acceptable. You're not trying to run Crysis 3 - you're running games that were designed for 233 MHz processors! ## Pro Tip Create different containers for different game collections: ```bash # One for The Sims docker run -d --name sims98 -p 8006:8006 -e VERSION="98" dockur/windows # One for Encarta and educational games docker run -d --name edu95 -p 8007:8006 -e VERSION="95" dockur/windows ``` Access them at different ports: `localhost:8006` and `localhost:8007` ## Comparing Alternatives If Docker performance isn't meeting your needs, consider these alternatives: ### UTM (Native Apple Virtualization) - **What it is:** Free virtualization app for Mac using Apple's Virtualization Framework - **Pros:** Better performance than Docker for full OS emulation, native Mac app - **Cons:** More manual setup, requires Windows installation media - **Use when:** You want the absolute best Windows emulation performance on Mac ### Parallels Desktop - **What it is:** Commercial virtualization software ($99/year) - **Pros:** Excellent performance, polished UI, good Windows ARM support - **Cons:** Expensive, subscription model, doesn't run x86 Windows well on Apple Silicon - **Use when:** You need modern Windows, not retro gaming ### Native Linux with KVM - **What it is:** Boot your Mac into Linux, run Docker there with KVM acceleration - **Pros:** Best possible performance (near-native x86 emulation) - **Cons:** Complex setup, loses macOS, requires rebooting - **Use when:** You're serious about retro gaming and willing to dual-boot ### CrossOver/Wine (No VM) - **What it is:** Runs Windows apps directly on macOS (no emulation/virtualization) - **Pros:** Lighter weight, better performance for compatible games - **Cons:** Very hit-or-miss compatibility, especially for Windows 95/98 games - **Use when:** Your specific game is known to work well with Wine **For most users:** Docker is the sweet spot between ease-of-use and functionality. It's not the fastest, but it's the most accessible and reproducible. ## Further Reading - [[Docker Intro]] - Understanding Docker fundamentals - [[Docker Desktop for Mac architecture documentation|https://docs.docker.com/desktop/features/vmm/]] - Official Docker VMM docs - `dockur/windows` GitHub repository for advanced configuration - DOSBox-X documentation for DOS-era games - Apple Virtualization Framework documentation for understanding the Mac virtualization stack