2024-07-19 08:06:53 +10:00
# Creating a Windows VM in `Docker` or `Podman`
Although WinApps supports using `QEMU+KVM+libvirt` as a backend for running Windows virtual machines, it is recommended to use `Docker` or `Podman` . These backends automate the setup process, eliminating the need for manual configuration and optimisation of the Windows virtual machine.
2024-05-26 12:31:05 +02:00
2024-07-19 08:06:53 +10:00
> [!IMPORTANT]
2024-07-22 13:13:51 +10:00
> Running a Windows virtual machine using `Docker` or `Podman` as a backend is only possible on GNU/Linux systems. This is due to the necessity of kernel interfaces, such as the KVM hypervisor, for achieving acceptable performance. The performance of the virtual machine can vary based on the version of the Linux kernel, with newer releases generally offering better performance.
2024-05-26 12:31:05 +02:00
2024-07-19 08:06:53 +10:00
> [!IMPORTANT]
2024-07-22 15:25:12 +10:00
> WinApps does __NOT__ officially support versions of Windows prior to Windows 10. Despite this, it may be possible to achieve a successful installation with some additional experimentation. If you find a way to achieve this, please share your solution through a pull request for the benefit of other users.
2025-01-12 22:59:38 +05:30
> Possible setup instructions for Windows 10:
2025-04-02 10:38:48 +00:00
> - 'Professional', 'Enterprise' or 'Server' editions of Windows are required to run RDP applications. Windows 'Home' will __NOT__ suffice.
2025-01-12 22:59:38 +05:30
> - It is recommended to edit the initial `compose.yaml` file to keep your required username and password from the beginning.
> - It is recommended to not use `sudo` to force commands to run. Add your user to the relevant permissions group wherever possible.
2025-02-16 15:26:15 +01:00
> [!IMPORTANT]
> The iptables kernel module must be loaded for folder sharing with the host to work.
> Check that the output of `lsmod | grep ip_tables` and `lsmod | grep iptable_nat` is non empty.
2025-02-16 15:46:37 +01:00
> If the output of one of the previous command is empty, run `echo -e "ip_tables\niptable_nat" | sudo tee /etc/modules-load.d/iptables.conf` and reboot.
2024-05-26 12:31:05 +02:00
2024-07-19 08:06:53 +10:00
## `Docker`
### Installation
You can find a guide for installing `Docker Engine` [here ](https://docs.docker.com/engine/install/ ).
2024-05-26 12:31:05 +02:00
2024-07-19 08:06:53 +10:00
### Setup `Docker` Container
2024-12-13 20:06:30 +01:00
WinApps utilises `docker compose` to configure Windows VMs. A template [`compose.yaml` ](../compose.yaml ) is provided.
2024-07-22 13:13:51 +10:00
Prior to installing Windows, you can modify the RAM and number of CPU cores available to the Windows VM by changing `RAM_SIZE` and `CPU_CORES` within `compose.yaml` .
2024-05-26 12:31:05 +02:00
2024-07-19 08:06:53 +10:00
It is also possible to specify the version of Windows you wish to install within `compose.yaml` by modifying `VERSION` .
2024-05-26 12:31:05 +02:00
2024-07-19 08:06:53 +10:00
Please refer to the [original GitHub repository ](https://github.com/dockur/windows ) for more information on additional configuration options.
2024-05-26 12:31:05 +02:00
2025-01-12 22:59:38 +05:30
> [!NOTE]
2025-01-15 08:30:13 +05:30
> If you want to undo all your changes and start from scratch, run the following. For `podman`, replace `docker compose` with `podman-compose`.
2025-01-12 22:59:38 +05:30
> ```bash
2025-01-13 23:17:06 +05:30
> docker compose down --rmi=all --volumes
2025-01-12 22:59:38 +05:30
> ```
2024-07-19 08:06:53 +10:00
### Installing Windows
2024-07-22 13:13:51 +10:00
You can initiate the Windows installation using `docker compose` .
2024-07-19 08:06:53 +10:00
```bash
2024-07-22 21:18:52 +10:00
cd winapps
docker compose --file ./compose.yaml up
2024-07-19 08:06:53 +10:00
```
2024-05-26 13:02:24 +00:00
2024-07-19 08:06:53 +10:00
You can then access the Windows virtual machine via a VNC connection to complete the Windows setup by navigating to http://127.0.0.1:8006 in your web browser.
2024-05-26 12:31:05 +02:00
2024-07-22 13:13:51 +10:00
### Changing `compose.yaml`
2025-04-03 01:51:17 +02:00
Changes to `compose.yaml` require the container to be removed and re-created. This should __NOT__ affect your data.
2024-07-22 13:13:51 +10:00
2024-07-19 08:06:53 +10:00
```bash
2025-04-03 01:51:17 +02:00
# Stop and remove the existing container.
2024-07-22 21:18:52 +10:00
docker compose --file ~/.config/winapps/compose.yaml down
# Remove the existing FreeRDP certificate (if required).
# Note: A new certificate will be created when connecting via RDP for the first time.
rm ~/.config/freerdp/server/127.0.0.1_3389.pem
2025-04-03 01:51:17 +02:00
# Re-create the container with the updated configuration.
2024-07-22 21:18:52 +10:00
docker compose --file ~/.config/winapps/compose.yaml up
2024-07-19 08:06:53 +10:00
```
2024-05-26 12:31:05 +02:00
2024-07-22 13:13:51 +10:00
### Subsequent Use
```bash
docker compose --file ~/.config/winapps/compose.yaml start # Power on the Windows VM
docker compose --file ~/.config/winapps/compose.yaml pause # Pause the Windows VM
docker compose --file ~/.config/winapps/compose.yaml unpause # Resume the Windows VM
docker compose --file ~/.config/winapps/compose.yaml restart # Restart the Windows VM
docker compose --file ~/.config/winapps/compose.yaml stop # Gracefully shut down the Windows VM
docker compose --file ~/.config/winapps/compose.yaml kill # Force shut down the Windows VM
```
2024-05-26 09:56:22 +02:00
2024-07-19 08:06:53 +10:00
## `Podman`
### Installation
1. Install `Podman` using [this guide ](https://podman.io/docs/installation ).
2. Install `podman-compose` using [this guide ](https://github.com/containers/podman-compose?tab=readme-ov-file#installation ).
2024-07-02 03:44:09 -03:00
2024-07-19 08:06:53 +10:00
### Setup `Podman` Container
Please follow the [`docker` instructions ](#setup-docker-container ).
2024-05-26 12:31:05 +02:00
2024-07-22 21:18:52 +10:00
> [!IMPORTANT]
2024-07-19 13:13:02 +10:00
> Ensure `WAFLAVOR` is set to `"podman"` in `~/.config/winapps/winapps.conf`.
2024-07-19 08:06:53 +10:00
### Installing Windows
2024-07-22 13:13:51 +10:00
You can initiate the Windows installation using `podman-compose` .
2024-07-19 08:06:53 +10:00
```bash
2024-07-22 21:18:52 +10:00
cd winapps
podman-compose --file ./compose.yaml up
2024-05-26 12:31:05 +02:00
```
2024-07-19 08:06:53 +10:00
You can then access the Windows virtual machine via a VNC connection to complete the Windows setup by navigating to http://127.0.0.1:8006 in your web browser.
2024-07-02 03:44:09 -03:00
2024-07-22 13:13:51 +10:00
### Changing `compose.yaml`
2025-04-03 01:51:17 +02:00
Changes to `compose.yaml` require the container to be removed and re-created. This should __NOT__ affect your data.
2024-07-22 21:18:52 +10:00
```bash
2025-04-03 01:51:17 +02:00
# Stop and remove the existing container.
2024-07-22 21:18:52 +10:00
podman-compose --file ~/.config/winapps/compose.yaml down
# Remove the existing FreeRDP certificate (if required).
# Note: A new certificate will be created when connecting via RDP for the first time.
rm ~/.config/freerdp/server/127.0.0.1_3389.pem
2025-04-03 01:51:17 +02:00
# Re-create the container with the updated configuration.
2024-07-22 21:18:52 +10:00
podman-compose --file ~/.config/winapps/compose.yaml up
```
2024-07-22 13:13:51 +10:00
2024-07-19 08:06:53 +10:00
### Subsequent Use
```bash
2024-07-22 13:13:51 +10:00
podman-compose --file ~/.config/winapps/compose.yaml start # Power on the Windows VM
podman-compose --file ~/.config/winapps/compose.yaml pause # Pause the Windows VM
podman-compose --file ~/.config/winapps/compose.yaml unpause # Resume the Windows VM
podman-compose --file ~/.config/winapps/compose.yaml restart # Restart the Windows VM
podman-compose --file ~/.config/winapps/compose.yaml stop # Gracefully shut down the Windows VM
podman-compose --file ~/.config/winapps/compose.yaml kill # Force shut down the Windows VM
2024-05-26 12:31:05 +02:00
```