Unable to update git submodules in a 4.8-windowsservercore-ltsc2019 image


My host system: Windows 10 Pro 64-bit and Windows Server 2016 64-bit
Docker Image: 4.8-windowsservercore-ltsc2019
Docker Version: 4.4.4
Dockerfile: I’ve opened an issue on Git-for-Windows repository. Dockerfile and a lot of other details can be found there.

How to reproduce the issue:

  1. Create a Windows image using the above mentioned Dockerfile: docker build -t buildtools2022:latest -m 2GB .
  2. Clone the OpenOCD repository locally: git clone https://github.com/openocd-org/openocd.git
  3. Run the image: docker run --rm -it -v %cd%:C:\Temp -w C:\Temp buildtools2022
  4. Perform: git submodule update --init

Somehow git cannot change into directories of the mapped volume. Any idea, what could be wrong? Such setup was already working a year or so ago but it is not available and I don’t know what software versions I had then.

I would also help if someone could at least reproduce this behaviour.

# escape=`

# Use a specific tagged image. Tags can be changed, though that is unlikely for most images.
# You could also use the immutable tag @sha256:324e9ab7262331ebb16a4100d0fb1cfb804395a766e3bb1806c62989d1fc1326
ARG FROM_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019

# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]

# Copy our Install script.
COPY Install.cmd C:\TEMP\

# Download collect.exe in case of an install failure.
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe

# Use the latest release channel. For more control, specify the location of an internal layout.
ARG CHANNEL_URL=https://aka.ms/vs/17/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman

ADD https://aka.ms/vs/17/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe

RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache modify `
       --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
       --channelUri C:\TEMP\VisualStudio.chman `
       --installChannelUri C:\TEMP\VisualStudio.chman `
       --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended `
       --add Microsoft.Component.MSBuild

# Install Python and Git.
RUN powershell.exe -ExecutionPolicy RemoteSigned `
       iex (new-object net.webclient).downloadstring('https://get.scoop.sh'); `
       scoop install python git vim

# Define the entry point for the Docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]