dockur / windows

Windows inside a Docker container.
MIT License
16.91k stars 1.43k forks source link

Cannot access shared folder using samba #661

Open renatofsp opened 1 month ago

renatofsp commented 1 month ago

Operating system

linux red hat Red Hat Enterprise Linux 8.10

Description

I started the windows container on linux Red Hat Enterprise Linux 8.10 using Docker version 20.10.24, build 297e128 system without issues eveything worked and windows server 2022 (in my case) was installed correctly I have connection via rdp fully working.

If I try to shared a folder inside the windows server 2022 I cannot reach it from the linux host or other machines connection via host I have port 443/tcp mapped on docker-compose.yml configuration so when connection to host it should reach the windows server.

I took a look and saw that port 445 was not mapped between "Debian GNU/Linux trixie/sid" and qemu-system-x86_6 so I mapped via volume mapping /home/myEntry.sh:/run/entry.sh overriding the default entry.sh script to set it as following: `#!/usr/bin/env bash set -Eeuo pipefail

: "${BOOT_MODE:="windows"}"

APP="Windows" SUPPORT="https://github.com/dockur/windows"

cd /run

. reset.sh # Initialize system . define.sh # Define versions . mido.sh # Download code . install.sh # Run installation . disk.sh # Initialize disks . display.sh # Initialize graphics . network.sh # Initialize network . samba.sh # Configure samba . boot.sh # Configure boot . proc.sh # Initialize processor . power.sh # Configure shutdown . config.sh # Configure arguments

trap - ERR

version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }') info "Booting ${APP}${BOOT_DESC} using QEMU v$version..."

{ qemu-system-x86_64 -net user,hostfwd=tcp::445-:445,${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || : (( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15

terminal ( sleep 10; boot ) & tail -fn +0 "$QEMU_LOG" 2>/dev/null & cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" & wait $! || :

sleep 1 & wait $! [ ! -f "$QEMU_END" ] && finish 0`

I added the -net user,hostfwd=tcp::445-:445, to the options for qemu-system-x86_64 executable to check if this would solve the situation the qemu-system-x86_64 mapping was done and now the port is binded on "Debian GNU/Linux trixie/sid" but still cannot reach it from host or other machines accessing the host hostname

I made a test installing smbclient on "Debian GNU/Linux trixie/sid" but I got `root@windows-2022:/# smbclient -L //localhost/test

WARNING: no network interfaces found Protocol negotiation (with timeout 20000 ms) timed out against server localhost`

anyone had this issue/need?

Thank you

Docker compose

windows-2022: image: dockurr/windows container_name: windows-2022 hostname: windows-2022 environment: VERSION: "2022" RAM_SIZE: "2G" CPU_CORES: "2" DISK_SIZE: "20GB" USERNAME: "user" PASSWORD: "pass" devices:

Docker log

BdsDxe: loading Boot0003 "Windows Boot Manager" from HD(1,GPT,6566ECF9-A5BB-4416-84CF-CC74D00D024E,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi BdsDxe: starting Boot0003 "Windows Boot Manager" from HD(1,GPT,6566ECF9-A5BB-4416-84CF-CC74D00D024E,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi ❯ Windows started succesfully, visit http://localhost:8006/ to view the screen...

Screenshots (optional)

ps aux netstat -tulpn

BADatCOMPUTER commented 1 month ago

If the samba share is on the host machine like mine, you should be able to do an ipconfig on the windows vm and map the share drive using the default gateway as the drive location. It works like that in QEMU, where all network adapters are simulated.

The only way I have gotten it to go both ways from QEMU is via a VPN from another device. VPNs are the honeybadgers of networking.

If I understand correctly, this Windows VM is still effectively in a compartmentalized Linux environment, so I don't know if TAP works. Even if you could get it working, I think you would need to specify a network adapter in the compose file. For your own sanity, don't even bother.

renatofsp commented 1 month ago

thanks for your help anyway