Symlinks with executable targets on volume mounts cannot be executed by cmd
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- docker, powershell
- Ambito
- infrastructure, operating-systems
Direzione di ricerca
La issue non indica alcun file sorgente né alcun test. Inizia riproducendo i comandi in un container Windows Server Core ltsc2022 con un volume montato tramite bind, includendo sia gli eseguibili collegati simbolicamente sia le directory collegate simbolicamente. Il lavoro è completato quando le destinazioni eseguibili vengono eseguite attraverso i percorsi dei collegamenti simbolici indicati da cmd, preservando il comportamento esistente per i file .bat.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- PowerShell
- Stelle
- 552
- Fork
- 75
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/Windows-Containers
-
enhancement triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/Windows-Containers#630 · 6 commenti ·
-
bug triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
microsoft/Windows-Containers#655 · 3 commenti ·
-
enhancement triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
microsoft/Windows-Containers#653 · 1 commento ·
-
enhancement triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
microsoft/Windows-Containers#652 · 1 commento ·
-
CimFS-backed overlay mount performance parity with Linux overlayfs for container image layersApertaenhancement triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
microsoft/Windows-Containers#651 · 1 commento ·
Tutte le issue di microsoft/Windows-Containers
Issue simili
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
TAMULib/fw-registry#543 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
ClusterLabs/fence-agents#663 ·
-
settings.py flaps between reconciles: needsMigrationSetting depends on map iteration orderForse già presa @fontaineajulien l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pulp/pulp-operator#1691 ·
-
[Lesson] A compatibility-gate rejection is a verdict, not something to overwrite with --accept-riskApertalesson-submission needs-ac pending-review
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Ikalus1988/MisakaNet#2870 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
semaphoreci/docker-images#46 · 1 commento ·