microsoft / microsoft/WSL

Windows interop doesn't work for .exe files that live inside of a Docker container

Open
#11,967 2 comments 2 reactions 0 assignees View on GitHub
feature tracking
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

### Windows Version

Microsoft Windows [Version 10.0.22631.3737]

### WSL Version

2.3.17.0

### Are you using WSL 1 or WSL 2?

- [X] WSL 2
- [ ] WSL 1

### Kernel Version

5.15.153.1-2

### Distro Version

Ubuntu 22.04

### Other Software

Docker (Ubuntu 22), version 24.0.7

### Repro Steps

1. Launch WSL (ubuntu-22.04).
2. Run `/mnt/c/Windows/System32/cmd.exe` and it works fine.
3. Run a custom `some-program.exe` that lives in Ubuntu's filesystem (maybe in /home/username) and it works fine.
4. Start a Docker container with `/run/WSL`, `/init`, `/mnt/wsl`, `/mnt/wslg`, and `/mnt/c` bind-mounted into the container, and the `WSL2_GUI_APPS_ENABLED` `WSL_INTEROP`, and `PULSE_SERVER` enviroment variables passed through to the container.
5. Run `/mnt/c/Windows/System32/cmd.exe` inside of the container and it works fine.
5. Run a custom `some-other-program.exe` that lives only in the Docker container and it fails with `./some-other-program.exe: Invalid argument`.
6. Look up the path to `some-other-program.exe` in the host's `/var/lib/docker/overlay2` and run it from there, and it works fine.

### Expected Behavior

`some-other-program.exe` should be launchable from inside of Docker.

### Actual Behavior

`some-other-program.exe` fails to launch from inside of Docker, possibly because of Docker container bind-mount path translation.

### Diagnostic Logs

[WslLogs-2024-08-28_23-33-06.zip](https://github.com/user-attachments/files/16789880/WslLogs-2024-08-28_23-33-06.zip)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the documented WSL 2 and Docker steps, comparing a host-mounted executable with one that exists only in the container. Review the attached WslLogs archive and investigate the interop path handling; done means custom .exe files stored inside the container launch successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, linux, ubuntu
Domain
infrastructure, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.