├── .github ├── .agp └── workflows │ ├── release.yml │ └── sync_readme.yml ├── .gitignore ├── README.md ├── _config.yml ├── docker-compose.yml ├── docker ├── Dockerfile ├── config │ └── .gitkeep ├── data │ └── .gitkeep ├── etc │ ├── cont-finish.d │ │ ├── 00-rm-macvtap.sh │ │ └── 00-rm-nat.sh │ ├── cont-init.d │ │ ├── 00-perms.sh │ │ └── 01-template.sh │ └── services.d │ │ ├── cockpit │ │ └── run │ │ ├── dbus │ │ └── run │ │ ├── libvirtd │ │ └── run │ │ ├── virtlockd │ │ └── run │ │ └── virtlogd │ │ └── run └── srv │ └── templates │ └── networks │ ├── macvtap.xml │ └── nat.xml └── preview ├── drivers.png └── scr.png /.github/.agp: -------------------------------------------------------------------------------- 1 | 2 | Auto Github Push (AGP) 3 | https://github.com/ms-jpq/auto-github-push 4 | 5 | --- 6 | 2022-03-24 00:44 7 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | paths: 6 | - ".github/**" 7 | - "build/**" 8 | - "release/**" 9 | - "root/**" 10 | branches: 11 | - gates 12 | schedule: 13 | - cron: "0 0 * * *" # daily 14 | 15 | jobs: 16 | build: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v2 22 | 23 | - name: Build 24 | uses: docker/build-push-action@v1 25 | with: 26 | username: ${{ secrets.DOCKER_USERNAME }} 27 | password: ${{ secrets.DOCKER_PASSWORD }} 28 | repository: ${{ secrets.DOCKER_USERNAME }}/kvm-windows 29 | tags: latest 30 | Dockerfile: docker/Dockerfile 31 | 32 | -------------------------------------------------------------------------------- /.github/workflows/sync_readme.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Sync Readme 3 | 4 | on: 5 | push: 6 | branches: 7 | - gates 8 | schedule: 9 | - cron: "0 0 * * *" # daily 10 | 11 | 12 | jobs: 13 | sync: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v2 19 | 20 | - name: Sync 21 | uses: ms-jpq/sync-dockerhub-readme@v1 22 | with: 23 | username: ${{ secrets.DOCKER_USERNAME }} 24 | password: ${{ secrets.DOCKER_PASSWORD }} 25 | repository: ${{ secrets.DOCKER_USERNAME }}/kvm-windows 26 | readme: "./README.md" 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.git/ 2 | /.venv/ 3 | /temp/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Much better project here 2 | 3 | [https://github.com/ms-jpq/windows-in-docker](https://github.com/ms-jpq/windows-in-docker) 4 | 5 | ![preview.img](https://raw.githubusercontent.com/ms-jpq/windows-in-docker/main/screenshots/virtman.png) 6 | 7 | --- 8 | 9 | # The thingy below is **depreciated** 10 | 11 | --- 12 | 13 | # [WIND - Windows in Docker](https://ms-jpq.github.io/windows-in-docker) 14 | 15 | Browser > Docker > KVM > Windows 16 | 17 | Thank you Redhat, very legal & very cool. 18 | 19 | ## WHY? 20 | 21 | QEMU + KVM has a relatively involved setup, not very user friendly. 22 | 23 | This image is vastly more user friendly, it comes with: 24 | 25 | 1. Browser UI 26 | 27 | 2. Networking out of the box 28 | 29 | 3. Literally copy paste install 30 | 31 | 4. Built-in Windows drivers 32 | 33 | 5. Crazy easy customizations, ie. `--cpus=9 --memory=6024 --size=120` 34 | 35 | ## Preview 36 | 37 | ![preview1 img](https://raw.githubusercontent.com/ms-jpq/windows-in-docker/gates/preview/scr.png) 38 | 39 | ![preview2 img](https://raw.githubusercontent.com/ms-jpq/windows-in-docker/gates/preview/drivers.png) 40 | 41 | ## Instructions 42 | 43 | ### Prerequisites 44 | 45 | You hardware must be able to run `KVM`. (Most computer can run at least 1 layer of virtualization now days.) 46 | 47 | ### Install 48 | 49 | Run the command below, and head to Firefox at port 8080 to finish installation 50 | 51 | ```sh 52 | docker -it --rm \ 53 | --privileged \ 54 | -v /lib/modules:/lib/modules:ro \ 55 | -p 8080:65080 \ 56 | -v /vm_image_dir:/config \ 57 | -v /iso_dir:/install \ 58 | msjpq/kvm-windows new --bios 59 | ``` 60 | 61 | **Add `--bios`, if your windows version is old, or else it will load UEFI** 62 | 63 | `` will eject after first poweroff, you will find the generated libvirt manifest under `/config`. 64 | 65 | Run the command below to finish installation, and for future usage. 66 | 67 | ```sh 68 | docker -it --rm \ 69 | --privileged \ 70 | -v /lib/modules:/lib/modules:ro \ 71 | -p 8080:65080 \ 72 | -v /vm_image_dir:/config \ 73 | msjpq/kvm-windows 74 | ``` 75 | 76 | #### Drivers 77 | 78 | You will need to manually install some of drivers, (VirtIO is annoying like that). 79 | 80 | ##### Essential 81 | 82 | 1. The harddrive drivers will need to be installed before first reboot. 83 | 84 | 2. The ethernet drivers will need to be installed after first login under Device Manager. 85 | 86 | ##### Whatever 87 | 88 | Things like `qxl` can also be installed under Device Manager. Not really important though. 89 | 90 | **All drivers are included with the default install, under `D:/` or `E:/` drive.** 91 | 92 | ##### Customization 93 | 94 | Additional flags to pass onto `new ...` 95 | 96 | | Flag | Default | Option | 97 | | ----------- | -------- | ------------------------------------------------------------------------- | 98 | | `--bios` | `False` | Boot `bios` instead of `uefi` | 99 | | `-os` | `win10` | Windows distro | 100 | | `--cpus` | `#cores` | Number of virtual cpus | 101 | | `--memory` | `4000` | (MB) | 102 | | `--vram` | `256` | (MB) | 103 | | `--size` | `100` | (GB) | 104 | | `--dry-run` | `False` | Dry run | 105 | | `--extra` | `None` | Extra args for [`virt-install`](https://linux.die.net/man/1/virt-install) | 106 | 107 | ### Networking 108 | 109 | All ports from VM are forwarded to container except: 110 | 111 | `53`, `67-68`, `65001-65535` 112 | 113 | **NOT** recommended to run with `--net=host`. 114 | 115 | ### Environmental Variables 116 | 117 | #### Browser UI 118 | 119 | - `-e PATH_PREFIX=/` 120 | - `-e VNC_RESIZE=scale|off` 121 | - `-e RECON_DELAY=250` reconnection delay (ms) 122 | 123 | #### Virtualization 124 | 125 | Libvirt look for `VM_NAME.xml` to boot. 126 | 127 | `new` will create `VM_NAME.xml` and `VM_NAME.img`. 128 | 129 | - `-e VM_NAME=wind` 130 | 131 | ### Ports 132 | 133 | - `-p 8080:65080` noVNC web UI 134 | 135 | - `-p 5900:65059` VNC 136 | 137 | ### Volumes 138 | 139 | Libvirt manifests are stored in`/config`, along with VM images. 140 | 141 | - `-v ./vm_data/:/config` 142 | 143 | You need to supply your own `windows.iso`, for obvious reasons. 144 | 145 | - `-v ./install_media/:/install` 146 | 147 | ### Disclaimer 148 | 149 | Works on my machine ™. 150 | 151 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | title: WIND - Windows in Docker 3 | 4 | showcase: True 5 | 6 | images: 7 | - https://raw.githubusercontent.com/ms-jpq/windows-in-docker/gates/preview/scr.png 8 | 9 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: "3.9" 3 | 4 | services: 5 | wind: 6 | restart: always 7 | privileged: True 8 | build: ./docker 9 | ports: 10 | - 127.0.0.1:8080:9090 11 | volumes: 12 | - /sys/fs/cgroup:/sys/fs/cgroup:ro 13 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fedora:latest 2 | 3 | 4 | ARG S6="https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-amd64-installer" 5 | 6 | 7 | RUN dnf install -y \ 8 | wget \ 9 | dbus-daemon \ 10 | cockpit \ 11 | cockpit-machines && \ 12 | dnf clean all && \ 13 | rm -rf /tmp/* 14 | 15 | 16 | RUN wget "${S6}" --output-document /tmp/s6 && \ 17 | chmod +x /tmp/s6 && \ 18 | /tmp/s6 / && \ 19 | rm -rf /tmp/* 20 | ENV S6_KEEP_ENV=1 \ 21 | S6_BEHAVIOUR_IF_STAGE2_FAILS=2 22 | ENTRYPOINT ["/init"] 23 | 24 | 25 | WORKDIR /srv/run 26 | COPY . / 27 | 28 | 29 | RUN printf '%s' 'root:docker!' | chpasswd 30 | -------------------------------------------------------------------------------- /docker/config/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-jpq/windows-in-docker-old/b9d43570a684cb4877b9b12e523011f6f8456f71/docker/config/.gitkeep -------------------------------------------------------------------------------- /docker/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-jpq/windows-in-docker-old/b9d43570a684cb4877b9b12e523011f6f8456f71/docker/data/.gitkeep -------------------------------------------------------------------------------- /docker/etc/cont-finish.d/00-rm-macvtap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | -------------------------------------------------------------------------------- /docker/etc/cont-finish.d/00-rm-nat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | -------------------------------------------------------------------------------- /docker/etc/cont-init.d/00-perms.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | 7 | -------------------------------------------------------------------------------- /docker/etc/cont-init.d/01-template.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | -------------------------------------------------------------------------------- /docker/etc/services.d/cockpit/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | 7 | export PATH="$PATH:/usr/libexec" 8 | 9 | 10 | exec cockpit-ws --no-tls 11 | 12 | 13 | -------------------------------------------------------------------------------- /docker/etc/services.d/dbus/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | 7 | mkdir -p /run/dbus/ 8 | 9 | exec dbus-daemon --system --nofork --nopidfile 10 | 11 | -------------------------------------------------------------------------------- /docker/etc/services.d/libvirtd/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | 7 | s6-svwait /var/run/s6/services/dbus 8 | s6-svwait /var/run/s6/services/virtlogd 9 | s6-svwait /var/run/s6/services/virtlockd 10 | 11 | 12 | exec /usr/sbin/libvirtd 13 | 14 | -------------------------------------------------------------------------------- /docker/etc/services.d/virtlockd/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | 7 | exec /usr/sbin/virtlockd 8 | 9 | -------------------------------------------------------------------------------- /docker/etc/services.d/virtlogd/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | set -o pipefail 5 | 6 | 7 | exec /usr/sbin/virtlogd 8 | 9 | -------------------------------------------------------------------------------- /docker/srv/templates/networks/macvtap.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-jpq/windows-in-docker-old/b9d43570a684cb4877b9b12e523011f6f8456f71/docker/srv/templates/networks/macvtap.xml -------------------------------------------------------------------------------- /docker/srv/templates/networks/nat.xml: -------------------------------------------------------------------------------- 1 | 2 | ${NAT_NAME} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /preview/drivers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-jpq/windows-in-docker-old/b9d43570a684cb4877b9b12e523011f6f8456f71/preview/drivers.png -------------------------------------------------------------------------------- /preview/scr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-jpq/windows-in-docker-old/b9d43570a684cb4877b9b12e523011f6f8456f71/preview/scr.png --------------------------------------------------------------------------------