Symlinks with executable targets on volume mounts cannot be executed by cmd
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, powershell
- Domain
- infrastructure, operating-systems
Research direction
The issue names no source files or tests. Start by reproducing the commands in a Windows Server Core ltsc2022 container with a bind-mounted volume, covering both symlinked executables and symlinked directories. Done means executable targets run through the reported symlink paths from cmd, while preserving the existing behavior for .bat files.
Written by the indexing model from the issue text.
Description
Please fill out all the sections below for bug issues, otherwise it'll be closed as it won't be actionable for us to address.
Describe the bug
Within a Windows container, if a symlink targets an executable file that exists on a bind mounted volume, the symlink is not executable by cmd. Furthermore, if a symlink to a directory within a mounted volume contains an executable, that executable will not run if called from the symlink's inherited directory structure. If the symlink itself exists on the mounted volume, a file not found error is returned, however if the symlink is local to the container, it fails silently.
It does not matter whether the shell's CWD is within the mount or not. It also doesn't matter if any of the symlinks are relative or absolute. This affects .exe files, but does not affect .bat files. Error messages are different in Powershell but the behavior remains.
If a local symlink is made to a mounted directory that itself contains symlinked executables, those symlinked executables will work.
Here's a relatively complete example, working on a Python installation stored at C:\usr\bin\python311 on the host machine:
PS C:\> docker run --rm -ti -v C:\usr:C:\xusr mcr.microsoft.com/windows/servercore:ltsc2022
Microsoft Windows [Version 10.0.20348.4773]
(c) Microsoft Corporation. All rights reserved.
C:\>dir C:\xusr\bin\python311\python.exe
Volume in drive C has no label.
Volume Serial Number is DE63-E9F8
Directory of C:\xusr\bin\python311
01/16/2025 04:18 PM 91,648 python.exe
1 File(s) 91,648 bytes
0 Dir(s) 178,053,509,120 bytes free
C:\>dir C:\xusr\bin\python311\python311.exe
Volume in drive C has no label.
Volume Serial Number is DE63-E9F8
Directory of C:\xusr\bin\python311
01/16/2025 04:18 PM <SYMLINK> python311.exe [python.exe]
1 File(s) 0 bytes
0 Dir(s) 178,051,469,312 bytes free
C:\>C:\xusr\bin\python311\python.exe -V
Python 3.11.11
C:\>C:\xusr\bin\python311\python311.exe -V
The system cannot find the file C:\xusr\bin\python311\python311.exe.
C:\>dir xusr\bin\xpy*
Volume in drive C has no label.
Volume Serial Number is DE63-E9F8
Directory of C:\xusr\bin
04/07/2026 03:07 PM <SYMLINKD> xpython311 [python311]
C:\>C:\xusr\bin\xpython311\python.exe -V
The system cannot find the file C:\xusr\bin\xpython311\python.exe.
C:\>mklink /d local_python C:\xusr\bin\python311
symbolic link created for local_python <<===>> C:\xusr\bin\python311
C:\>local_python\python311.exe -V
Python 3.11.11
C:\>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\> .\xusr\bin\python311\python311.exe
Program 'python311.exe' failed to run: Class not registeredAt line:1 char:1
+ .\xusr\bin\python311\python311.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
PS C:\> .\xusr\bin\xpython311\python.exe
Program 'python.exe' failed to run: The system cannot find the path specifiedAt line:1 char:1
+ .\xusr\bin\xpython311\python.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ .\xusr\bin\xpython311\python.exe
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
PS C:\> .\local_python\python311.exe -V
Python 3.11.11
To Reproduce
Start a Windows container with a bind volume that contains either a symlinked executable or a symlinked directory containing an executable. From a command prompt in that container, call the symlinked executable or an executable in the symlinked directory through that symlink.
Expected behavior
In these cases, the executable should run.
Configuration:
- Edition: Tried on Windows 11 and Windows Server 2022, 21H2
- Base Image being used: mcr.microsoft.com/windows/servercore:ltsc2022
- Container engine: Docker
- Container Engine version: Docker Desktop v4.68.0 on Windows 11, Docker CE 24.0.9 on Windows Server
Additional context
We're using an old version of Docker Engine on the Windows Server instance because of this issue. The hash on the servercore image I'm testing on is 9bbf5a183232.
Apologies if my explanation is a bit unclear. This was a bit difficult to describe but easy to show, so hopefully the example will help.
- Dominant language
- PowerShell
- Stars
- 552
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/Windows-Containers
-
enhancement triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/Windows-Containers#630 · 6 comments ·
-
enhancement triage
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/Windows-Containers#653 · 1 comment ·
-
enhancement triage
Difficulty 5/5 Over a week Newbie friendliness 30/100
microsoft/Windows-Containers#652 · 1 comment ·
-
enhancement triage
Difficulty 5/5 Over a week Newbie friendliness 30/100
microsoft/Windows-Containers#651 · 1 comment ·
-
enhancement triage
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/Windows-Containers#650 · 2 comments ·
All issues in microsoft/Windows-Containers
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
community-scripts/ProxmoxVE#17674 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
EPFL-ENAC/co2-calculator#3007 ·
Maintainers usually reply within 1 day
-
area/config comp/gateway duplicate P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
NousResearch/hermes-agent#132565 ·
Maintainers usually reply within 1 day
-
priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ll7/robot_sf_ll7#10128 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DrozmotiX/ioBroker.tado#1213 ·
Maintainers usually reply within 1 day