-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Windows: Docker container builds spawn many console windows #12963
Description
Description
When running wrangler deploy on Windows with [[containers]] configured, the Docker build step spawns numerous console windows that flash open during the build process.
Root Cause
In wrangler-dist/cli.js, both dockerBuild() and runDockerCmd() use childProcess.spawn() with detached: true:
const child = childProcess.spawn(dockerPath, options.buildCmd, {
stdio: ["pipe", "inherit", "inherit"],
detached: true
});From the Node.js docs:
On Windows, setting
options.detachedtotruemakes it possible for the child process to continue running after the parent exits. The child will have its own console window.
This causes Docker BuildKit's subprocesses to each open their own visible console window.
Suggested Fix
Set detached conditionally based on platform, and add windowsHide: true:
const child = childProcess.spawn(dockerPath, options.buildCmd, {
stdio: ["pipe", "inherit", "inherit"],
detached: process.platform !== "win32",
windowsHide: true
});This preserves the existing behavior on macOS/Linux (detached for process group cleanup) while preventing console window spam on Windows. windowsHide: true is a no-op on non-Windows platforms.
Both dockerBuild() and runDockerCmd() in cli.js need this change.
Environment
- OS: Windows 11
- Wrangler: 4.72.0
- Node: 22
- Docker Desktop with BuildKit
Reproduction
- Create a Workers project with
[[containers]]inwrangler.tomlpointing to a Dockerfile - Run
wrangler deployon Windows - Observe many console windows spawning during the Docker build step
Metadata
Metadata
Assignees
Labels
Type
Projects
Status