param( [string]$ContainerName = "gui-app-container", [switch]$Build ) if ($Build) { Write-Host "Building Docker image: $ContainerName" -ForegroundColor Green docker build -t $ContainerName . if ($LASTEXITCODE -ne 0) { Write-Host "Build failed!" -ForegroundColor Red exit 1 } } $dockerCommand = @( "run", "-it", "--rm", "--name", $ContainerName, "-v", "/tmp/.X11-unix:/tmp/.X11-unix", "-v", "/run/desktop/mnt/wslg:/mnt/wslg", "-e", "DISPLAY=$DISPLAY", "-e", "WAYLAND_DISPLAY=wayland-0", "-e", "XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir" ) $dockerCommand += $ContainerName + " bash" docker @dockerCommand