Compare commits

...

8 Commits
v1.05 ... v1.08

Author SHA1 Message Date
Kroese
accd1799d2 feat: Display progress via web (#61) 2024-01-20 17:03:59 +01:00
Kroese
6566d249fc feat: Use Virtiso image for drivers (#59) 2024-01-19 21:29:03 +01:00
Kroese
a2cc998c60 feat: Show warnings (#58) 2024-01-19 15:18:56 +01:00
Kroese
6e24a2ae51 docs: Readme (#57) 2024-01-19 08:12:16 +01:00
Kroese
42b412704c docs: Readme (#56) 2024-01-19 04:31:20 +01:00
Kroese
245b3fc019 fix: Sanitize filename (#55) 2024-01-19 04:28:03 +01:00
Kroese
5137d513fc feat: Support more image layouts (#54) 2024-01-19 01:25:39 +01:00
Kroese
82bccfc43d feat: Disable hardware checks (#52) 2024-01-18 19:11:59 +01:00
5 changed files with 217 additions and 60 deletions

View File

@@ -16,8 +16,8 @@ RUN apt-get update \
COPY ./src /run/
COPY ./assets /run/assets
ADD https://github.com/qemus/virtiso/raw/master/virtio-win.iso /run/drivers.iso
ADD https://raw.githubusercontent.com/ElliotKillick/Mido/main/Mido.sh /run/mido.sh
ADD https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso /run/drivers.iso
RUN chmod +x /run/*.sh

View File

@@ -89,6 +89,24 @@
<AcceptEula>true</AcceptEula>
</UserData>
<EnableFirewall>false</EnableFirewall>
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>3</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\LabConfig" /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>4</Order>
<Path>reg.exe add "HKLM\SYSTEM\Setup\MoSetup" /v AllowUpgradesWithUnsupportedTPMOrCPU /t REG_DWORD /d 1 /f</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
<component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DriverPaths>
@@ -264,6 +282,7 @@
<ProtectYourPC>3</ProtectYourPC>
<HideEULAPage>true</HideEULAPage>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
</OOBE>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
@@ -278,12 +297,20 @@
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>3</Order>
<CommandLine>reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV1 /d 0 /t REG_DWORD /f</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>4</Order>
<CommandLine>reg.exe add "HKCU\Control Panel\UnsupportedHardwareNotificationCache" /v SV2 /d 0 /t REG_DWORD /f</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>5</Order>
<RequiresUserInput>false</RequiresUserInput>
<CommandLine>cmd /C wmic useraccount where name="Docker" set PasswordExpires=false</CommandLine>
<Description>Password Never Expires</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<Order>4</Order>
<Order>6</Order>
<CommandLine>msiexec /i E:\virtio-win-gt-x64.msi /qb!</CommandLine>
<Description>Install VirtIO drivers</Description>
</SynchronousCommand>

View File

@@ -60,7 +60,9 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN dockurr/w
- Sit back and relax while the magic happens, the whole installation will be performed fully automatic.
- Once you see the desktop, your Windows installation is ready for use. Enjoy it, and don't forget to star this repo!
- Once you see the desktop, your Windows installation is ready for use.
- Enjoy your brand new machine, and don't forget to star this repo!
* ### How do I select the Windows version?
@@ -73,13 +75,13 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN dockurr/w
Select from the values below:
- ```win11``` (Windows 11)
- ```win10``` (Windows 10)
- ```win81``` (Windows 8.1)
- ```win22``` (Windows Server 2022)
- ```win19``` (Windows Server 2019)
- ```win16``` (Windows Server 2016)
- ```win11``` = Windows 11
- ```win10``` = Windows 10
- ```win81``` = Windows 8.1
- ```win22``` = Windows Server 2022
- ```win19``` = Windows Server 2019
- ```win16``` = Windows Server 2016
* ### How do I increase the amount of CPU or RAM?
By default, 2 CPU cores and 4 GB of RAM are allocated to the container, as those are the minimum requirements of Windows 11.
@@ -143,14 +145,14 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN dockurr/w
* ### How do I install an unsupported version?
You can specify an URL in the `VERSION` environment variable, in order to download a custom ISO file:
You can specify an URL in the `VERSION` environment variable, in order to download a custom ISO image:
```yaml
environment:
VERSION: "https://example.com/win.iso"
```
During the installation you will need to add some drivers as described in [manual installation](https://github.com/dockur/windows/tree/master?tab=readme-ov-file#how-do-i-perform-a-manual-installation) above.
During the installation you may need to add some drivers as described in [manual installation](https://github.com/dockur/windows/tree/master?tab=readme-ov-file#how-do-i-perform-a-manual-installation) above.
* ### How do I pass-through a disk?

View File

@@ -1,10 +1,9 @@
#!/usr/bin/env bash
set -Eeuo pipefail
echo " Starting Windows for Docker v$(</run/version)..."
echo " For support visit https://github.com/dockur/windows"
APP="Windows"
export BOOT_MODE=windows
SUPPORT="https://github.com/dockur/windows"
cd /run
@@ -19,11 +18,7 @@ cd /run
trap - ERR
if [[ "${DISPLAY,,}" == "web" ]]; then
nginx -e stderr
fi
info "Booting Windows using $VERS..."
info "Booting $APP using $VERS..."
[[ "$DEBUG" == [Yy1]* ]] && set -x
exec qemu-system-x86_64 ${ARGS:+ $ARGS}

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
set -Eeuo pipefail
: "${MANUAL:="N"}"
: "${EXTERNAL:="N"}"
: "${MANUAL:=""}"
: "${EXTERNAL:=""}"
: "${VERSION:="win11x64"}"
[[ "${VERSION,,}" == "http"* ]] && EXTERNAL="Y"
[[ "${VERSION,,}" == "11" ]] && VERSION="win11x64"
[[ "${VERSION,,}" == "win11" ]] && VERSION="win11x64"
@@ -34,45 +32,52 @@ set -Eeuo pipefail
[[ "${VERSION,,}" == "win16" ]] && VERSION="win2016-eval"
[[ "${VERSION,,}" == "win2016" ]] && VERSION="win2016-eval"
MSG="Please wait while Windows is being started..."
if [[ "${VERSION,,}" == "tiny10" ]]; then
VERSION="https://archive.org/download/tiny-10-23-h2/tiny10%20x64%2023h2.iso"
fi
if [[ "${VERSION,,}" == "tiny11" ]]; then
VERSION="https://archive.org/download/tiny-11-core-x-64-beta-1/tiny11%20core%20x64%20beta%201.iso"
fi
if [[ "${VERSION,,}" == "http"* ]]; then
EXTERNAL="Y"
else
EXTERNAL="N"
fi
MSG="Windows is being started, please wait..."
BASE="custom.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
if [ ! -f "$STORAGE/custom.iso" ]; then
if [[ "$EXTERNAL" != [Yy1]* ]]; then
if [ ! -f "$STORAGE/$VERSION.iso" ]; then
MSG="Please wait while Windows is being downloaded..."
BASE="$VERSION.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Windows is being downloaded, please wait..."
fi
else
BASE=$(basename "$VERSION")
BASE=$(basename "${VERSION%%\?*}")
: "${BASE//+/ }"; printf -v BASE '%b' "${_//%/\\x}"
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while '$BASE' is being downloaded..."
MSG="Image '$BASE' is being downloaded, please wait..."
fi
fi
fi
# Display wait message
/run/server.sh "Windows" "$MSG" &
BASE="custom.iso"
[ -f "$STORAGE/$BASE" ] && return 0
if [[ "$EXTERNAL" != [Yy1]* ]]; then
BASE="$VERSION.iso"
else
BASE=$(basename "$VERSION")
fi
html "$MSG"
[ -f "$STORAGE/$BASE" ] && return 0
TMP="$STORAGE/tmp"
rm -rf "$TMP" && mkdir -p "$TMP"
rm -rf "$TMP"
mkdir -p "$TMP"
ISO="$TMP/$BASE"
rm -f "$ISO"
@@ -102,48 +107,176 @@ else
{ wget "$VERSION" -O "$ISO" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
(( rc != 0 )) && error "Failed to download $VERSION, reason: $rc" && exit 60
(( rc != 0 )) && echo && error "Failed to download $VERSION, reason: $rc" && exit 60
fi
[ ! -f "$ISO" ] && error "Failed to download $VERSION" && exit 61
[ ! -f "$ISO" ] && echo && error "Failed to download $VERSION" && exit 61
SIZE=$(stat -c%s "$ISO")
if ((SIZE<10000000)); then
error "Invalid ISO file: Size is smaller than 10 MB" && exit 62
echo && error "Invalid ISO file: Size is smaller than 10 MB" && exit 62
fi
info "Preparing ISO image for installation..."
MSG="Extracting downloaded ISO image..."
echo && info "$MSG" && html "$MSG"
DIR="$TMP/unpack"
rm -rf "$DIR"
7z x "$ISO" -o"$DIR"
7z x "$ISO" -o"$DIR" > /dev/null
echo
FB="falling back to manual installation!"
ETFS="boot/etfsboot.com"
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
if [ ! -f "$DIR/$ETFS" ] || [ ! -f "$DIR/$EFISYS" ]; then
if [ ! -f "$DIR/$ETFS" ]; then
warn "failed to locate file 'etfsboot.com' in ISO image, $FB"
else
warn "failed to locate file 'efisys_noprompt.bin' in ISO image, $FB"
fi
mv "$ISO" "$STORAGE/$BASE"
rm -rf "$TMP"
echo && return 0
fi
if [ -z "$MANUAL" ]; then
MANUAL="N"
if [[ "$EXTERNAL" == [Yy1]* ]]; then
[[ "${BASE,,}" == "tiny10"* ]] && MANUAL="Y"
fi
fi
XML=""
if [[ "$MANUAL" != [Yy1]* ]]; then
if [[ "$EXTERNAL" != [Yy1]* ]]; then
if [ -f "/run/assets/$VERSION.xml" ]; then
wimlib-imagex update "$DIR/sources/boot.wim" 2 \
--command "add /run/assets/$VERSION.xml /autounattend.xml"
XML="$VERSION.xml"
else
MSG="Detecting Windows version from ISO image..."
info "$MSG" && html "$MSG"
LOC="$DIR/sources/install.wim"
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
if [ -f "$LOC" ]; then
DETECTED=""
TAG="DISPLAYNAME"
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
if [ -z "$NAME" ]; then
TAG="PRODUCTNAME"
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
fi
[[ "${NAME,,}" == "windows 11"* ]] && DETECTED="win11x64"
[[ "${NAME,,}" == "windows 10"* ]] && DETECTED="win10x64"
[[ "${NAME,,}" == "windows 8"* ]] && DETECTED="win81x64"
[[ "${NAME,,}" == *"server 2022"* ]] && DETECTED="win2022-eval"
[[ "${NAME,,}" == *"server 2019"* ]] && DETECTED="win2019-eval"
[[ "${NAME,,}" == *"server 2016"* ]] && DETECTED="win2016-eval"
if [ -n "$DETECTED" ]; then
XML="$DETECTED.xml"
echo "Detected image of type '$DETECTED', will apply autounattend.xml file."
else
if [ -z "$NAME" ]; then
warn "failed to detect Windows version from image, $FB"
else
if [[ "${NAME,,}" == "windows 7" ]]; then
warn "detected Windows 7 image, $FB"
else
warn "failed to detect Windows version from string '$NAME', $FB"
fi
fi
fi
else
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
fi
echo
fi
fi
LABEL="${BASE%.*}"
LABEL="${LABEL::32}"
ASSET="/run/assets/$XML"
if [ -f "$ASSET" ]; then
LOC="$DIR/sources/boot.wim"
[ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd"
if [ -f "$LOC" ]; then
MSG="Adding XML file for automatic installation..."
info "$MSG" && html "$MSG"
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
if [[ "${RESULT^^}" == *"<IMAGE INDEX=\"2\">"* ]]; then
INDEX="2"
else
INDEX="1"
fi
wimlib-imagex update "$LOC" "$INDEX" --command "add $ASSET /autounattend.xml" > /dev/null
else
warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
fi
LOC="$DIR/autounattend.xml"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/Autounattend.xml"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/AutoUnattend.xml"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/autounattend.XML"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/Autounattend.XML"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/AutoUnattend.XML"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/AUTOUNATTEND.xml"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
LOC="$DIR/AUTOUNATTEND.XML"
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
echo
else
if [ -n "$XML" ]; then
warn "XML file '$XML' does not exist, $FB" && echo
fi
fi
CAT="BOOT.CAT"
LABEL="${BASE%.*}"
LABEL="${LABEL::30}"
ISO="$TMP/$LABEL.tmp"
rm -f "$ISO"
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames \
-v -V "$LABEL" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin \
-no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
MSG="Generating new ISO image for installation..."
info "$MSG" && html "$MSG"
genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$LABEL" -udf \
-boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
mv "$ISO" "$STORAGE/$BASE"
rm -rf "$TMP"
html "Successfully prepared image for installation..."
echo
return 0