Skip to content

--runtime flag of docker run is ignored on Windows #50542

@slonopotamus

Description

@slonopotamus

Description

Docker ignores custom runtime that is specified when creating a container on Windows.

Reproduce

docker run --rm -it --runtime C:\path\to\custom\runtime.exe hello-world

Expected behavior

Custom runtime is used to run container.

docker version

Client:
 Version:           27.5.1-rd
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        0c97515
 Built:             Thu Jan 23 18:14:31 2025
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Engine - Community
 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:    27.5.1-rd
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.20.1
    Path:     C:\Program Files\Rancher Desktop\resources\resources\win32\docker-cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.33.0
    Path:     C:\Program Files\Rancher Desktop\resources\resources\win32\docker-cli-plugins\docker-compose.exe

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 2
 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 26100 (26100.1.amd64fre.ge_release.240331-1435)
 Operating System: Microsoft Windows Version 24H2 (OS Build 26100.4652)
 OSType: windows
 Architecture: x86_64
 CPUs: 20
 Total Memory: 63.71GiB
 Name: MSI
 ID: a30b884a-4857-4af9-b964-a52dab0590b9
 Docker Root Dir: C:\ProgramData\docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Additional Info

Problematic code is

if libcontainerd.ContainerdRuntimeEnabled {
opts := &options.Options{}
return config.WindowsV2RuntimeName, opts, nil
}
return "", nil, nil

Path to runtime is available via Container.HostConfig.Runtime, but it is ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions