docker / docker/cli

Windows Docker image fails to run

Open
#6,347 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug platform/windows status/0-triage status/more-info-needed
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description

I have a Windows Docker image that I try to run using Docker Desktop for Windows. This image was created in three steps:

  1. Execute the command docker run -i --name vsbuildtools_install_container -v %CD%:C:\InstallSource -w C:\InstallSource mcr.microsoft.com/dotnet/framework/sdk:4.8.1-windowsservercore-ltsc2022 cmd /c Install.bat to create a base image (will be used as a base for other images too)
  2. Execute the command docker container commit vsbuildtools_install_container my_tag
  3. Do a docker build using a Dockerfile that copies some additional files into the image with the tag from step 2.

The Install.bat of step 1 just executes the following command:
layout\vs_BuildTools --noWeb --quiet --wait --norestart --nocache --installPath C:\BuildTools --config dependencies\VS2022.config || IF "%ERRORLEVEL%"=="3010" EXIT 0
This will install Visual Studio 2022 based on a previously downloaded offline installer.

Now when I run the image my_tag with the command docker run -ti my_tag I get the following error:

docker: Error response from daemon: container 88c1500d02763339d365a78c83410186664b892ceff6ec0806f829f19461e365 encountered an error during hcs::System::CreateProcess: C:\TEMP\entrypoint.cmd type C:\TEMP\README: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF76E6AF5AD: (caller: 00007FF76E654C97) Exception(2) tid(3c8) 80070002 The system cannot find the file specified.
    CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess]
 Provider: 00000000-0000-0000-0000-000000000000]

Also when I try to override the entrypoint with an additional --entrypoint "cmd /c cmd" or by adding cmd /c cmd after the tag name, I still get the same error, except for the first line where C:\TEMP\entrypoint.cmd is replaced by cmd /c cmd.

Reproduce

See above

Expected behavior

The image just runs

docker version
Client:
 Version:           28.3.2
 API version:       1.51
 Go version:        go1.24.5
 Git commit:        578ccf6
 Built:             Wed Jul  9 16:12:31 2025
 OS/Arch:           windows/amd64
 Context:           desktop-windows

Server: Docker Desktop 4.44.2 (202017)
 Engine:
  Version:          28.3.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.5
  Git commit:       e77ff99
  Built:            Wed Jul  9 15:41:13 2025
  OS/Arch:          windows/amd64
  Experimental:     false
docker info
Client:
 Version:    28.3.2
 Context:    desktop-windows
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.9.11
    Path:     C:\Program Files\Docker\cli-plugins\docker-ai.exe
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.26.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  cloud: Docker Cloud (Docker Inc.)
    Version:  v0.4.18
    Path:     C:\Program Files\Docker\cli-plugins\docker-cloud.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.39.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.42
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.2.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-desktop.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.29
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.13.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-mcp.exe
  model: Docker Model Runner (EXPERIMENTAL) (Docker Inc.)
    Version:  v0.1.36
    Path:     C:\Program Files\Docker\cli-plugins\docker-model.exe
  offload: Docker Offload (Docker Inc.)
    Version:  v0.4.18
    Path:     C:\Users\vgm1bda\.docker\cli-plugins\docker-offload.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.18.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 3
  Running: 0
  Paused: 0
  Stopped: 3
 Images: 62
 Server Version: 28.3.2
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 22631 (22621.1.amd64fre.ni_release.220506-1250)
 Operating System: Microsoft Windows Version 23H2 (OS Build 22631.5768)
 OSType: windows
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.71GiB
 Name: BOX-C-000J5
 ID: 2594620a-b8f2-4ce4-a32a-4aee39b867f2
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: false
 Labels:
  com.docker.desktop.address=npipe://\\.\pipe\docker_cli
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
Additional Info

I have tried a lot of times to install Visual Studio via a Docker file, but our corporate proxies and other network settings let that fail every time (either with network timeouts, or just no installation). That is why I tried to do it the unconventional way with running an install script inside a container and then commit that container to tag it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the three-step image creation flow and the subsequent docker run commands on Docker Desktop for Windows, recording whether the hcs::System::CreateProcess error occurs. Compare the default entrypoint with the reported overrides; done means the committed Windows image starts successfully without the 0x2 file-not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.