The service can be accessed from outside when running in Windows, but not when running in Docker
Operating system
ubuntu 24.04
Description
I have added an web_server(port:8000) within the Docker layer and configured port mapping when starting the Docker image. However, I am unable to access web_server externally. Interestingly, if I run web_server manually within the Windows environment, external access works fine. Could you please provide guidance on how to troubleshoot and resolve this issue with web_server not being accessible when running within the Docker environment?"
Docker compose
version: "3"
services:
windows:
image: dockurr/windows
build: .
container_name: windows
privileged: true
environment:
VERSION: "http://winiso/win11x64.iso"
MANUAL: "N"
TPM: "N"
#DEBUG: Y
ARGUMENTS: "-device vfio-pci,host=01:00.0,multifunction=on -device vfio-pci,host=01:00.1,multifunction=on -device usb-host,vendorid=0x1a2c,productid=0x6004 -device usb-host,vendorid=0x1c4f,productid=0x0034"
RAM_SIZE: "4G"
CPU_CORES: "4"
DISK_SIZE: "64G"
devices:
- /dev/dri
- /dev/kvm
- /dev/vfio/13
- /dev/bus/usb
group_add:
- "0"
cap_add:
- NET_ADMIN
- SYS_ADMIN
ports:
- 8000:8000
- 3389:3389/tcp
- 3389:3389/udp
volumes:
- ./win:/storage
depends_on:
- winiso
winiso:
image: nginx:latest
container_name: winiso
restart: on-failure
volumes:
- ./iso:/usr/share/nginx/html
I start my web service by modifying entry.sh
"#!/usr/bin/env bash set -Eeuo pipefail
: "${BOOT_MODE:="windows"}"
APP="Windows" SUPPORT="https://github.com/dockur/windows" nohup /run/web_server & 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 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || : (( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
terminal ( sleep 30; 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"
If you need to access the ports in the container you need to add their numbers to HOST_PORTS variable otherwise they will be forwarded to Windows.