2024年4月11日 星期四

docker 安裝windows系列

在ubuntu 建置docker及compose

安裝KVM

sudo apt install cpu-checker -y

執行 sudo kvm-ok 

順利的話出現

INFO: /dev/kvm exists
KVM acceleration can be used

 1.下載windows鏡像

docker pull dockurr/windows

也可以選擇本地構建:

git clone https://github.com/dockur/windows.git

cd windows

docker build -t dockurr/windows .

2.建立docker-compose.yml

#version: "3" --目前新版本已不適用
services:
  windows:
    image: dockurr/windows
    container_name: windows
    privileged: true
    environment:
      VERSION: "win11"
      BOOT_MODE: "windows_plain"
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3389:3389/tcp
      - 3389:3389/udp
    stop_grace_period: 2m
    restart: on-failure
    network_mode: bridge
3.執行docker compose up
4.用瀏覽器連 docker主機IP:8006
ValueDescriptionSourceTransferSize
win11Windows 11 ProMicrosoftFast6.4 GB
win10Windows 10 ProMicrosoftFast5.8 GB
ltsc10Windows 10 LTSCMicrosoftFast4.6 GB
win81Windows 8.1 ProMicrosoftFast4.2 GB
win7Windows 7 SP1Bob PonyMedium3.0 GB
vistaWindows Vista SP2Bob PonyMedium3.6 GB
winxpWindows XP SP3Bob PonyMedium0.6 GB
2022Windows Server 2022MicrosoftFast4.7 GB
2019Windows Server 2019MicrosoftFast5.3 GB
2016Windows Server 2016MicrosoftFast6.5 GB
2012Windows Server 2012 R2MicrosoftFast4.3 GB
2008Windows Server 2008 R2MicrosoftFast3.0 GB
core11Tiny 11 CoreArchive.orgSlow2.1 GB
tiny11Tiny 11Archive.orgSlow3.8 GB
tiny10Tiny 10Archive.orgSlow3.6 GB

參考:https://github.com/dockur/windows
https://soulteary.com/2024/03/11/install-windows-into-a-docker-container.html#%E5%86%99%E5%9C%A8%E5%89%8D%E9%9D%A2




沒有留言:

張貼留言