dockur / windows

Windows inside a Docker container.
MIT License
29.22k stars 1.99k forks source link

[Bug]: VNC is ok but RDP error with 0x904 #754

Closed HareToAme closed 1 month ago

HareToAme commented 1 month ago

Operating system

Ubuntu 20.04 in VMware

Description

I tested both win7 and win8e, and they all have the same issue: VNC works fine, internet access is normal, and mounting is normal, but RDP cannot connect (error code 0x904).

I didn't test Windows 10 because, as is well known, it tends to get stuck for a long time during the initial installation phase due to unknown reasons.

Docker compose

# please install podman, then:
# pip install podman-compose
# podman compose -f ~/compose.yml up

name: "my_windows" # Docker Compose Project Name.
volumes:
  # Create Volume 'data'.
  # Located @ '/var/lib/docker/volumes/my_windows_data/_data' (Docker).
  # Located @ '/var/lib/containers/storage/volumes/my_windows_data/_data' or '~/.local/share/containers/storage/volumes/my_windows_data/_data' (Podman).
  data:
services:
  windows:
    image: dockurr/windows:3.17 # https://hub.docker.com/r/dockurr/windows
    container_name: my_windows # Created Docker VM Name.
    environment:
      # Version of Windows to configure. For valid options, visit:
      # https://github.com/dockur/windows?tab=readme-ov-file#how-do-i-select-the-windows-version
      # https://github.com/dockur/windows?tab=readme-ov-file#how-do-i-install-a-custom-image

      # VERSION: "ltsc10" # will auto download https://drive.massgrave.dev/zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso  stuck more than 1h,BOOT_MODE: "windows_plain" is useless.
      # BOOT_MODE: "windows_plain" # https://github.com/dockur/windows/issues/226

      # win8e: about 1h to install
      VERSION: "win8e" # will auto download https://drive.massgrave.dev/cn_windows_8.1_enterprise_with_update_x64_dvd_6050374.iso

      # win7: about 20min to install
      # VERSION: "win7" # will auto download https://drive.massgrave.dev/cn_windows_7_enterprise_with_sp1_x64_dvd_u_677685.iso

      LANGUAGE: "Chinese"
      KVM: "N" # Disable KVM
      RAM_SIZE: "4G" # RAM allocated to the Windows VM.
      CPU_CORES: "4" # CPU cores allocated to the Windows VM.
      DISK_SIZE: "32G" # Size of the primary hard disk.
      #DISK2_SIZE: "32G" # Uncomment to add an additional hard disk to the Windows VM. Ensure it is mounted as a volume below.
      USERNAME: "xxxxx" # Uncomment to set a custom Windows username. The default is 'Docker'.
      PASSWORD: "xxxxxxxxx" # Uncomment to set a password for the Windows user. There is no default password.
    privileged: true # Grant the Windows VM extended privileges.
    ports:
      - 11115:8006 # Map '11115' on Linux host to '8006' on Windows VM --> For VNC Web Interface @ http://127.0.0.1:11115.
      - 11116:3389/tcp # Map '11116' on Linux host to '3389' on Windows VM --> For Remote Desktop Protocol (RDP).
      - 11117:3389/udp # Map '11117' on Linux host to '3389' on Windows VM --> For Remote Desktop Protocol (RDP).
    stop_grace_period: 120s # Wait 120 seconds before sending SIGTERM when attempting to shut down the Windows VM.
    #restart: on-failure # Restart the Windows VM if the exit code indicates an error.
    volumes:
      - data:/storage # Mount volume 'data' to use as Windows 'C:' drive.
      - /home/aaaaaaaa:/shared # Mount Linux directory @ '\\host.lan\Data'.
      #- /path/to/second/hard/disk:/storage2 # Uncomment to mount the second hard disk within the Windows VM. Ensure 'DISK2_SIZE' is specified above.
      #- ./oem:/oem # Enables automatic post-install execution of 'oem/install.bat', applying Windows registry modifications contained within 'oem/RDPApps.reg'.
      # - ./win81x64-enterprise.xml:/run/assets/win81x64.xml # change productkey
      # - ./cn_windows_8.1_enterprise_with_update_x64_dvd_6050374.iso:/custom.iso # Uncomment to use a custom Windows ISO. If specified, 'VERSION' (e.g. 'ltsc10') will be ignored.
    #devices:
      #- /dev/kvm
      #- /dev/sdX:/disk1 # Uncomment to mount a disk directly within the Windows VM (Note: 'disk1' will be mounted as the main drive).
      #- /dev/sdY:/disk2 # Uncomment to mount a disk directly within the Windows VM (Note: 'disk2' and higher will be mounted as secondary drives).

Docker log

❯ Starting Windows for Docker v3.17...
❯ For support visit https://github.com/dockur/windows
❯ CPU: 11th Gen Intel Core TM i7 1165G7 | RAM: 6/8 GB | DISK: 18 GB (ext4) | HOST: 5.15.0-119...

❯ Extracting local ISO image...
❯ Detecting version from ISO image...
❯ Detected: + (Chinese)
❯ Adding drivers to image...
❯ Adding win81x64.xml for automatic installation...
❯ Building Windows 8 image...
❯ Creating a 32G growable disk image in raw format...
❯ Booting Windows securely using QEMU v9.0.2...

BdsDxe: failed to load Boot0002 "UEFI QEMU QEMU HARDDISK " from PciRoot(0x0)/Pci(0xA,0x0)/Scsi(0x0,0x0): Not Found
BdsDxe: loading Boot0001 "UEFI QEMU QEMU CD-ROM " from PciRoot(0x0)/Pci(0x5,0x0)/Scsi(0x0,0x0)
BdsDxe: starting Boot0001 "UEFI QEMU QEMU CD-ROM " from PciRoot(0x0)/Pci(0x5,0x0)/Scsi(0x0,0x0)
❯ Windows started succesfully, visit http://localhost:8006/ to view the screen...

BdsDxe: loading Boot0003 "Windows Boot Manager" from HD(1,GPT,100A5582-BDFF-4617-9A7C-8A289C96B3B0,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi
BdsDxe: starting Boot0003 "Windows Boot Manager" from HD(1,GPT,100A5582-BDFF-4617-9A7C-8A289C96B3B0,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi

Screenshots (optional)

mstsc errors with 0x904 and 0x7: 无标题

Additional Information on Installation Time:

I installed VMware and ran Ubuntu 20.04 on my Windows 11 laptop, where I used podman to start this container(no KVM).

kroese commented 1 month ago

First, I would not advice to run without KVM, it will be too slow to be useable.

Secondly, when Googling for the error I found:

"After some testing, it turns out that the Bitdefender Security started blocking the connection.

Adding rdp.exe to the exception list allowed it to reconnect."

See https://community.spiceworks.com/t/after-windows-11-upgrade-rdp-error-0x904-extended-error-0x7/804277