mirror of
https://github.com/dockur/windows.git
synced 2026-01-13 14:35:27 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4371bd37d | ||
|
|
46de9e8fc0 | ||
|
|
6b31a9d943 | ||
|
|
d02fa6cca1 | ||
|
|
1cf2562354 | ||
|
|
73793dbcaa | ||
|
|
0aea392b28 | ||
|
|
5084dc78ba | ||
|
|
30daaf3a53 | ||
|
|
4a07728214 | ||
|
|
3884da71ca |
@@ -16,7 +16,7 @@ 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://github.com/qemus/virtiso/releases/download/v0.1.240/virtio-win-0.1.240.iso /run/drivers.iso
|
||||
RUN chmod +x /run/*.sh
|
||||
|
||||
EXPOSE 8006 3389
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
<OSImage>
|
||||
<InstallFrom>
|
||||
<MetaData wcm:action="add">
|
||||
<Key>/IMAGE/INDEX</Key>
|
||||
<Value>1</Value>
|
||||
<Key>/IMAGE/INDEX</Key>
|
||||
</MetaData>
|
||||
</InstallFrom>
|
||||
<InstallTo>
|
||||
@@ -76,7 +76,7 @@
|
||||
<FullName>Docker</FullName>
|
||||
<Organization>Windows for Docker</Organization>
|
||||
<ProductKey>
|
||||
<Key>D4F6K-QK3RD-TMVMJ-BBMRX-3MBMV</Key>
|
||||
<Key>H7X92-3VPBB-Q799D-Y6JJ3-86WC6</Key>
|
||||
<WillShowUI>OnError</WillShowUI>
|
||||
</ProductKey>
|
||||
</UserData>
|
||||
30
readme.md
30
readme.md
@@ -15,7 +15,6 @@ Windows in a docker container.
|
||||
|
||||
## Features
|
||||
|
||||
- Multi-platform
|
||||
- ISO downloader
|
||||
- KVM acceleration
|
||||
- Web-based viewer
|
||||
@@ -72,19 +71,22 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
||||
environment:
|
||||
VERSION: "win11"
|
||||
```
|
||||
|
||||
|
||||
Select from the values below:
|
||||
|
||||
- ```win11``` = Windows 11
|
||||
- ```win10``` = Windows 10
|
||||
- ```ltsc10``` = Windows 10 LTSC
|
||||
- ```win81``` = Windows 8.1
|
||||
- ```win22``` = Windows Server 2022
|
||||
- ```win19``` = Windows Server 2019
|
||||
- ```win16``` = Windows Server 2016
|
||||
- ```tiny11``` = Tiny 11 (Slow download)
|
||||
- ```tiny10``` = Tiny 10 (Slow download)
|
||||
- ```win7``` = Windows 7 (Slow download)
|
||||
| **Value** | **Description** | **Server** | **Transfer** | **Size** |
|
||||
|---|---|---|---|---|
|
||||
| `win11` | Windows 11 Pro | Microsoft | Fast | 6.4 GB |
|
||||
| `win10` | Windows 10 Pro | Microsoft | Fast | 5.8 GB |
|
||||
| `ltsc10` | Windows 10 LTSC | Microsoft | Fast | 4.6 GB |
|
||||
| `win81` | Windows 8.1 Pro | Microsoft | Fast | 4.2 GB |
|
||||
| `win7` | Windows 7 SP1 | Bob Pony | Medium | 3.0 GB |
|
||||
| `win22` | Windows Server 2022 | Microsoft | Fast | 4.7 GB |
|
||||
| `win19` | Windows Server 2019 | Microsoft | Fast | 5.3 GB |
|
||||
| `win16` | Windows Server 2016 | Microsoft | Fast | 6.5 GB |
|
||||
| `tiny10` | Tiny 10 | Archive.org | Slow | 3.6 GB |
|
||||
| `tiny11` | Tiny 11 | Archive.org | Slow | 3.8 GB |
|
||||
| `core11` | Tiny 11 Core | Archive.org | Slow | 2.1 GB |
|
||||
|
||||
* ### How do I increase the amount of CPU or RAM?
|
||||
|
||||
@@ -122,7 +124,9 @@ docker run -it --rm -p 8006:8006 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
|
||||
|
||||
* ### How do I perform a manual installation?
|
||||
|
||||
It's best to use the automatic installation, as it optimizes various settings for use with this container. However, if you insist on performing the installation manually, start a clean container with the following environment variable:
|
||||
It's best to use the automatic installation, as it optimizes various settings for use with this container.
|
||||
|
||||
However, if you insist on performing the installation manually, start a clean container with the following environment variable:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
|
||||
169
src/install.sh
169
src/install.sh
@@ -2,6 +2,7 @@
|
||||
set -Eeuo pipefail
|
||||
|
||||
: "${MANUAL:=""}"
|
||||
: "${DETECTED:=""}"
|
||||
: "${VERSION:="win11x64"}"
|
||||
|
||||
if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
|
||||
@@ -20,9 +21,8 @@ fi
|
||||
[[ "${VERSION,,}" == "win81" ]] && VERSION="win81x64"
|
||||
[[ "${VERSION,,}" == "win8" ]] && VERSION="win81x64"
|
||||
|
||||
[[ "${VERSION,,}" == "7" ]] && VERSION="win7x64-ultimate"
|
||||
[[ "${VERSION,,}" == "win7" ]] && VERSION="win7x64-ultimate"
|
||||
[[ "${VERSION,,}" == "win7x64" ]] && VERSION="win7x64-ultimate"
|
||||
[[ "${VERSION,,}" == "7" ]] && VERSION="win7x64"
|
||||
[[ "${VERSION,,}" == "win7" ]] && VERSION="win7x64"
|
||||
|
||||
[[ "${VERSION,,}" == "22" ]] && VERSION="win2022-eval"
|
||||
[[ "${VERSION,,}" == "2022" ]] && VERSION="win2022-eval"
|
||||
@@ -44,11 +44,27 @@ fi
|
||||
[[ "${VERSION,,}" == "win10-ltsc" ]] && VERSION="win10x64-enterprise-ltsc-eval"
|
||||
[[ "${VERSION,,}" == "win10x64-ltsc" ]] && VERSION="win10x64-enterprise-ltsc-eval"
|
||||
|
||||
if [[ "${VERSION,,}" == "tiny11" ]]; then
|
||||
if [[ "${VERSION,,}" == "win10x64-enterprise-ltsc-eval" ]]; then
|
||||
DETECTED="win10x64-ltsc"
|
||||
fi
|
||||
|
||||
if [[ "${VERSION,,}" == "win7x64" ]]; then
|
||||
DETECTED="win7x64"
|
||||
VERSION="https://dl.bobpony.com/windows/7/en_windows_7_enterprise_with_sp1_x64_dvd_u_677651.iso"
|
||||
fi
|
||||
|
||||
if [[ "${VERSION,,}" == "core11" ]]; then
|
||||
DETECTED="win11x64"
|
||||
VERSION="https://archive.org/download/tiny-11-core-x-64-beta-1/tiny11%20core%20x64%20beta%201.iso"
|
||||
fi
|
||||
|
||||
if [[ "${VERSION,,}" == "tiny11" ]]; then
|
||||
DETECTED="win11x64"
|
||||
VERSION="https://archive.org/download/tiny11-2311/tiny11%202311%20x64.iso"
|
||||
fi
|
||||
|
||||
if [[ "${VERSION,,}" == "tiny10" ]]; then
|
||||
DETECTED="win10x64-ltsc"
|
||||
VERSION="https://archive.org/download/tiny-10-23-h2/tiny10%20x64%2023h2.iso"
|
||||
fi
|
||||
|
||||
@@ -68,6 +84,25 @@ FB="falling back to manual installation!"
|
||||
ETFS="boot/etfsboot.com"
|
||||
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
||||
|
||||
printVersion() {
|
||||
|
||||
local id="$1"
|
||||
local desc=""
|
||||
|
||||
[[ "$id" == "win7"* ]] && desc="Windows 7"
|
||||
[[ "$id" == "win8"* ]] && desc="Windows 8"
|
||||
[[ "$id" == "win10"* ]] && desc="Windows 10"
|
||||
[[ "$id" == "win11"* ]] && desc="Windows 11"
|
||||
[[ "$id" == "winvista"* ]] && desc="Windows Vista"
|
||||
[[ "$id" == "win2022"* ]] && desc="Windows Server 2022"
|
||||
[[ "$id" == "win2019"* ]] && desc="Windows Server 2019"
|
||||
[[ "$id" == "win2016"* ]] && desc="Windows Server 2016"
|
||||
[[ "$id" == "win10x64-ltsc" ]] && desc="Windows 10 LTSC"
|
||||
|
||||
echo "$desc"
|
||||
return 0
|
||||
}
|
||||
|
||||
replaceXML() {
|
||||
|
||||
local dir="$1"
|
||||
@@ -147,7 +182,7 @@ abortInstall() {
|
||||
|
||||
startInstall() {
|
||||
|
||||
local magic
|
||||
local magic desc
|
||||
local msg="Windows is being started, please wait..."
|
||||
|
||||
if [ -f "$STORAGE/$CUSTOM" ]; then
|
||||
@@ -170,7 +205,10 @@ startInstall() {
|
||||
BASE="$VERSION.iso"
|
||||
|
||||
if ! skipInstall && [ ! -f "$STORAGE/$BASE" ]; then
|
||||
msg="Windows is being downloaded, please wait..."
|
||||
|
||||
desc=$(printVersion "$VERSION")
|
||||
[ -z "$desc" ] && desc="Windows"
|
||||
msg="$desc is being downloaded, please wait..."
|
||||
fi
|
||||
|
||||
else
|
||||
@@ -261,7 +299,7 @@ downloadImage() {
|
||||
fi
|
||||
|
||||
{ wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || :
|
||||
(( rc != 0 )) && error "Failed to download $url, reason: $rc" && exit 60
|
||||
(( rc != 0 )) && error "Failed to download $url , reason: $rc" && exit 60
|
||||
|
||||
[ ! -f "$iso" ] && return 1
|
||||
return 0
|
||||
@@ -271,9 +309,15 @@ extractImage() {
|
||||
|
||||
local iso="$1"
|
||||
local dir="$2"
|
||||
local desc="downloaded ISO"
|
||||
local size size_gb space space_gb
|
||||
|
||||
local msg="Extracting downloaded ISO image..."
|
||||
if [[ "$EXTERNAL" != [Yy1]* ]] && [ -z "$CUSTOM" ]; then
|
||||
desc=$(printVersion "$VERSION")
|
||||
[ -z "$desc" ] && desc="downloaded ISO"
|
||||
fi
|
||||
|
||||
local msg="Extracting $desc image..."
|
||||
[ -n "$CUSTOM" ] && msg="Extracting local ISO image..."
|
||||
info "$msg" && html "$msg"
|
||||
|
||||
@@ -297,35 +341,24 @@ extractImage() {
|
||||
exit 66
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
BOOT_MODE="windows_legacy"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
findVersion() {
|
||||
getVersion() {
|
||||
|
||||
local name="$1"
|
||||
local detected=""
|
||||
|
||||
[[ "${name,,}" == *"windows 11"* ]] && detected="win11x64"
|
||||
[[ "${name,,}" == *"windows 7"* ]] && detected="win7x64"
|
||||
[[ "${name,,}" == *"windows 8"* ]] && detected="win81x64"
|
||||
[[ "${name,,}" == *"windows 11"* ]] && detected="win11x64"
|
||||
[[ "${name,,}" == *"windows vista"* ]] && detected="winvistax64"
|
||||
[[ "${name,,}" == *"server 2022"* ]] && detected="win2022-eval"
|
||||
[[ "${name,,}" == *"server 2019"* ]] && detected="win2019-eval"
|
||||
[[ "${name,,}" == *"server 2016"* ]] && detected="win2016-eval"
|
||||
[[ "${name,,}" == *"windows 7"* ]] && detected="win7x64-ultimate"
|
||||
|
||||
|
||||
if [[ "${name,,}" == *"windows 10"* ]]; then
|
||||
if [[ "${name,,}" == *"enterprise ltsc"* ]]; then
|
||||
if [[ "${name,,}" == *"ltsc"* ]]; then
|
||||
detected="win10x64-ltsc"
|
||||
else
|
||||
detected="win10x64"
|
||||
@@ -338,30 +371,35 @@ findVersion() {
|
||||
|
||||
detectImage() {
|
||||
|
||||
local dir="$1"
|
||||
local tag result name name2
|
||||
|
||||
XML=""
|
||||
DETECTED=""
|
||||
|
||||
if [[ "$EXTERNAL" != [Yy1]* ]] && [ -z "$CUSTOM" ]; then
|
||||
if [[ "${VERSION,,}" != "win10x64-enterprise-ltsc-eval" ]]; then
|
||||
if [ -n "$CUSTOM" ]; then
|
||||
DETECTED=""
|
||||
else
|
||||
if [ -z "$DETECTED" ] && [[ "$EXTERNAL" != [Yy1]* ]]; then
|
||||
DETECTED="$VERSION"
|
||||
else
|
||||
DETECTED="win10x64-ltsc"
|
||||
fi
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||
XML="$DETECTED.xml"
|
||||
else
|
||||
warn "image type is '$DETECTED', but no matching XML file exists, $FB."
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$DETECTED" ]; then
|
||||
|
||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local dsc
|
||||
dsc=$(printVersion "$DETECTED")
|
||||
[ -z "$dsc" ] && dsc="$DETECTED"
|
||||
|
||||
warn "got $desc, but no matching XML file exists, $FB."
|
||||
return 0
|
||||
fi
|
||||
|
||||
info "Detecting Windows version from ISO image..."
|
||||
|
||||
local dir="$1"
|
||||
local tag result name name2 desc
|
||||
local loc="$dir/sources/install.wim"
|
||||
[ ! -f "$loc" ] && loc="$dir/sources/install.esd"
|
||||
|
||||
@@ -374,35 +412,33 @@ detectImage() {
|
||||
tag="DISPLAYNAME"
|
||||
result=$(wimlib-imagex info -xml "$loc" | tr -d '\000')
|
||||
name=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$result")
|
||||
DETECTED=$(findVersion "$name")
|
||||
DETECTED=$(getVersion "$name")
|
||||
|
||||
if [ -z "$DETECTED" ]; then
|
||||
|
||||
tag="PRODUCTNAME"
|
||||
name2=$(sed -n "/$tag/{s/.*<$tag>\(.*\)<\/$tag>.*/\1/;p}" <<< "$result")
|
||||
[ -z "$name" ] && name="$name2"
|
||||
DETECTED=$(findVersion "$name2")
|
||||
DETECTED=$(getVersion "$name2")
|
||||
|
||||
fi
|
||||
|
||||
if [ -n "$DETECTED" ]; then
|
||||
if [ -z "$DETECTED" ]; then
|
||||
warn "failed to determine Windows version from string '$name', $FB"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||
info "Detected image of type: '$DETECTED'"
|
||||
else
|
||||
warn "detected image of type '$DETECTED', but no matching XML file exists, $FB."
|
||||
fi
|
||||
desc=$(printVersion "$DETECTED")
|
||||
[ -z "$desc" ] && desc="$DETECTED"
|
||||
|
||||
if [ -f "/run/assets/$DETECTED.xml" ]; then
|
||||
[[ "$MANUAL" != [Yy1]* ]] && XML="$DETECTED.xml"
|
||||
info "Detected: $desc"
|
||||
else
|
||||
|
||||
if [ -z "$name" ]; then
|
||||
warn "failed to determine Windows version from image, $FB"
|
||||
else
|
||||
warn "failed to determine Windows version from string '$name', $FB"
|
||||
fi
|
||||
|
||||
warn "detected $desc, but no matching XML file exists, $FB."
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
prepareImage() {
|
||||
@@ -410,7 +446,21 @@ prepareImage() {
|
||||
local iso="$1"
|
||||
local dir="$2"
|
||||
|
||||
[[ "${DETECTED,,}" != "win7x64"* ]] && return 0
|
||||
if [[ "${BOOT_MODE,,}" == "windows" ]]; then
|
||||
if [[ "${DETECTED,,}" != "win7x64"* ]] && [[ "${DETECTED,,}" != "winvistax64"* ]]; then
|
||||
|
||||
if [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -f "$dir/$ETFS" ]; then
|
||||
warn "failed to locate file 'etfsboot.com' in ISO image, falling back to legacy boot!"
|
||||
else
|
||||
warn "failed to locate file 'efisys_noprompt.bin' in ISO image, falling back to legacy boot!"
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
ETFS="boot.img"
|
||||
BOOT_MODE="windows_legacy"
|
||||
@@ -469,13 +519,16 @@ buildImage() {
|
||||
local cat="BOOT.CAT"
|
||||
local label="${BASE%.*}"
|
||||
local log="/run/shm/iso.log"
|
||||
local size size_gb space space_gb
|
||||
local size size_gb space space_gb desc
|
||||
|
||||
label="${label::30}"
|
||||
local out="$TMP/$label.tmp"
|
||||
rm -f "$out"
|
||||
|
||||
local msg="Updating ISO image..."
|
||||
desc=$(printVersion "$DETECTED")
|
||||
[ -z "$desc" ] && desc="ISO"
|
||||
|
||||
local msg="Building $desc image..."
|
||||
info "$msg" && html "$msg"
|
||||
|
||||
size=$(du -h -b --max-depth=0 "$dir" | cut -f1)
|
||||
|
||||
Reference in New Issue
Block a user