mirror of
https://github.com/dockur/windows.git
synced 2026-01-14 06:56:51 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bef943281 | ||
|
|
32e6b2a77e | ||
|
|
cabf74a0ba | ||
|
|
1a08bcea4a | ||
|
|
5d32e036dc | ||
|
|
a958bb1dcf | ||
|
|
ed4f6f7f7f | ||
|
|
f1bcd5a9ee | ||
|
|
3943181075 | ||
|
|
9fd26e4145 | ||
|
|
21ea7584a4 | ||
|
|
0652998966 | ||
|
|
131fa1379b | ||
|
|
748bf5f4e7 | ||
|
|
7cc56998cb |
@@ -8,17 +8,23 @@ RUN apt-get update \
|
||||
&& apt-get --no-install-recommends -y install \
|
||||
curl \
|
||||
novnc \
|
||||
swtpm \
|
||||
p7zip-full \
|
||||
genisoimage \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY ./src /run/
|
||||
|
||||
ADD https://raw.githubusercontent.com/ElliotKillick/Mido/main/Mido.sh /run/mido.sh
|
||||
ADD https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso /run/drivers.iso
|
||||
|
||||
RUN chmod +x /run/*.sh
|
||||
|
||||
EXPOSE 8006
|
||||
VOLUME /storage
|
||||
|
||||
ENV CPU_CORES "1"
|
||||
ENV CPU_CORES "2"
|
||||
ENV RAM_SIZE "4G"
|
||||
ENV DISK_SIZE "64G"
|
||||
|
||||
|
||||
49
readme.md
49
readme.md
@@ -1,4 +1,4 @@
|
||||
<h1 align="center">Windows for Docker<br />
|
||||
<h1 align="center">Windows in Docker<br />
|
||||
<div align="center">
|
||||
<img src="https://github.com/dockur/windows/raw/master/.github/logo.png" title="Logo" style="max-width:100%;" width="128" />
|
||||
</div>
|
||||
@@ -16,7 +16,9 @@ Windows in a docker container.
|
||||
## Features
|
||||
|
||||
- Multi-platform
|
||||
- ISO downloader
|
||||
- KVM acceleration
|
||||
- Web-based viewer
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -29,7 +31,7 @@ services:
|
||||
container_name: windows
|
||||
image: dockurr/windows:latest
|
||||
environment:
|
||||
VERSION: "win10x64"
|
||||
VERSION: "win11x64"
|
||||
devices:
|
||||
- /dev/kvm
|
||||
cap_add:
|
||||
@@ -43,39 +45,58 @@ services:
|
||||
Via `docker run`
|
||||
|
||||
```bash
|
||||
docker run -it --rm -e "VERSION=win10x64" -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN dockurr/windows:latest
|
||||
docker run -it --rm -e "VERSION=win11x64" -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN dockurr/windows:latest
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
* ### How do I perform the installation?
|
||||
|
||||
- Start the container and wait until the ISO download is completed. If needed, you can view this progress in the Docker log, wait until you see the message ```BdsDxe: starting Boot```.
|
||||
|
||||
- Connect to port 8006 of the container in your webbrowser.
|
||||
|
||||
- Start the installation by clicking ```Install now```. On the next screen, press 'OK' when prompted for ```Load driver``` and select the ```VirtIO SCSI``` driver from the list that matches your Windows version. So for Windows 11, select ```D:\amd64\w11\vioscsi.inf``` and click 'Next'.
|
||||
|
||||
- Accept the license agreement and select your preferred Windows edition, like Home or Pro.
|
||||
|
||||
- Choose ```Custom: Install Windows only (advanced)```, and click ```Load driver``` in the next screen. Select 'Browse' and navigate to the ```D:\NetKVM\w11\amd64``` folder and click 'OK'. Select the ```VirtIO Ethernet Adapter``` from the list, and click 'Next'.
|
||||
|
||||
- Select 'Drive 0' and click 'Next'.
|
||||
|
||||
- Wait until Windows finishes copying files and completes the installation.
|
||||
|
||||
- Once you see your desktop, open File Explorer and navigate to the CD-ROM drive (D:). Double-click on ```virtio-win-gt-x64``` and proceed to install the VirtIO drivers.
|
||||
|
||||
- Now your Windows installation is ready for use. Enjoy it and don't forget to star this repo!
|
||||
|
||||
* ### How do I specify the Windows version?
|
||||
|
||||
You can modify the `VERSION` environment variable to specify the version you want:
|
||||
You can modify the `VERSION` environment variable to specify the version of Windows you want to download:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
VERSION: "win10x64"
|
||||
VERSION: "win11x64"
|
||||
```
|
||||
|
||||
Select from the values below:
|
||||
|
||||
- ~~```win11x64``` (Windows 11)~~
|
||||
- ```win11x64``` (Windows 11)
|
||||
- ```win10x64``` (Windows 10)
|
||||
- ```win81x64``` (Windows 8.1)
|
||||
- ```win7x64-ultimate``` (Windows 7 )
|
||||
- ```win2016-eval``` (Windows Server 2016)
|
||||
- ```win2019-eval``` (Windows Server 2019)
|
||||
- ```win2022-eval``` (Windows Server 2022)
|
||||
|
||||
* ### How do I see the screen?
|
||||
- ```win2019-eval``` (Windows Server 2019)
|
||||
- ```win2016-eval``` (Windows Server 2016)
|
||||
|
||||
* ### How can I view the screen?
|
||||
|
||||
The container includes a web-based viewer, so you can visit [http://localhost:8006/](http://localhost:8006/) using any webbrowser to view the screen and interact with Windows via the keyboard/mouse.
|
||||
|
||||
Alternatively it is also possible to connect to port 5900 using a VNC client like RealVNC or many others.
|
||||
|
||||
This is mainly for use during installation, as afterwards you can use Remote Desktop, TeamViewer or any other software you prefer.
|
||||
|
||||
* ### How do I increase the amount of CPU or RAM?
|
||||
|
||||
By default, a single core and 4 GB of RAM are allocated to the container.
|
||||
By default, 2 CPU cores and 4 GB of RAM are allocated to the container, as that are the minimum requirements of Windows 11.
|
||||
|
||||
To increase this, add the following environment variables:
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ echo "❯ For support visit https://github.com/dockur/windows"
|
||||
export DISPLAY=web
|
||||
export BOOT_MODE=windows
|
||||
|
||||
ln -sfn /usr/share/novnc/vnc_lite.html /usr/share/novnc/index.html
|
||||
websockify -D --web /usr/share/novnc/ 8006 localhost:5900 2>/dev/null
|
||||
|
||||
cd /run
|
||||
|
||||
. reset.sh # Initialize system
|
||||
@@ -20,9 +23,8 @@ cd /run
|
||||
|
||||
trap - ERR
|
||||
|
||||
if [[ "${DISPLAY,,}" == "web" ]]; then
|
||||
websockify -D --web /usr/share/novnc/ 8006 localhost:5900 2>/dev/null
|
||||
fi
|
||||
mkdir -p /tmp/emulated_tpm
|
||||
swtpm socket -t -d --tpmstate dir=/tmp/emulated_tpm --ctrl type=unixio,path=/tmp/emulated_tpm/swtpm-sock --log level=1 --tpm2
|
||||
|
||||
info "Booting Windows using $VERS..."
|
||||
|
||||
|
||||
@@ -1,40 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
: "${VERSION:="win10x64"}"
|
||||
: "${VERSION:="win11x64"}"
|
||||
|
||||
ARGUMENTS="-chardev socket,id=chrtpm,path=/tmp/emulated_tpm/swtpm-sock $ARGUMENTS"
|
||||
ARGUMENTS="-tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 $ARGUMENTS"
|
||||
|
||||
BASE="$VERSION.iso"
|
||||
[ -f "$STORAGE/$BASE" ] && return 0
|
||||
|
||||
# Check if running with interactive TTY or redirected to docker log
|
||||
if [ -t 1 ]; then
|
||||
PROGRESS="--progress=bar:noscroll"
|
||||
else
|
||||
PROGRESS="--progress=dot:giga"
|
||||
fi
|
||||
rm -rf "$STORAGE/tmp"
|
||||
mkdir -p "$STORAGE/tmp"
|
||||
SCRIPT="$STORAGE/tmp/mido.sh"
|
||||
|
||||
SCRIPT="$STORAGE/mido.sh"
|
||||
|
||||
rm -f "$SCRIPT"
|
||||
cp /run/mido.sh "$SCRIPT"
|
||||
chmod +x "$SCRIPT"
|
||||
|
||||
cd "$STORAGE/tmp"
|
||||
bash "$SCRIPT" "$VERSION"
|
||||
rm -f "$SCRIPT"
|
||||
|
||||
[ ! -f "$STORAGE/$BASE" ] && error "Failed to download $VERSION.iso!" && exit 66
|
||||
[ ! -f "$STORAGE/tmp/$BASE" ] && error "Failed to download $VERSION.iso from the Microsoft servers!" && exit 66
|
||||
|
||||
DEST="$STORAGE/drivers.img"
|
||||
info "Customizing ISO to remove keypress requirement during boot..."
|
||||
|
||||
if [ ! -f "$DEST" ]; then
|
||||
7z x "$BASE" -ounpack
|
||||
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -v -V "Custom" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin -no-emul-boot -o "$STORAGE/tmp/$BASE.tmp" -allow-limited-size unpack
|
||||
|
||||
info "Downloading VirtIO drivers for Windows..."
|
||||
DRIVERS="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso"
|
||||
mv "$STORAGE/tmp/$BASE.tmp" "$STORAGE/$BASE"
|
||||
rm -rf "$STORAGE/tmp"
|
||||
|
||||
{ wget "$DRIVERS" -O "$DEST" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
|
||||
|
||||
(( rc != 0 )) && info "Failed to download $DRIVERS, reason: $rc" && rm -f "$DEST"
|
||||
|
||||
fi
|
||||
cd /run
|
||||
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user