Description
Setup
- Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
Step 5/10 : RUN git --version --build-options
---> Running in 3d9c46cb4a76
git version 2.11.0.windows.1
sizeof-long: 4
machine: x86_64
- Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
Step 6/10 : RUN cmd.exe /c ver
---> Running in 2c465adb3865
Microsoft Windows [Version 10.0.14393]
- What options did you set as part of the installation? Or did you choose the
defaults?
Step 7/10 : RUN type 'C:\Program Files\Git\etc\install-options.txt'
---> Running in ded3512e22b7
Path Option: CmdTools
SSH Option: OpenSSH
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Difftool: Disabled
- Any other interesting things about your environment that might be related
to the issue you're seeing?
Running Git for Windows in a Windows Container directly on a volume mount point.
Details
- Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other
PowerShell
- What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Running inside a Windows container works fine:
PS C:\> docker run git-for-windows-issue git clone https://chromium.googlesource.com/external/gyp
Cloning into 'gyp'...
Running in a Windows container with a volume mounted from the Windows Docker host does not work:
PS C:\> docker run -v "$(pwd):C:\work" git-for-windows-issue git clone https://chromium.googlesource.com/external/gyp
Cloning into 'gyp'...
fatal: Could not switch to '/ContainerMappedDirectories/': No such file or directory
The Container directory C:\work
is mounted from the Docker host. This can be shown with the dir
command like this:
PS C:\> docker run -v "$(pwd):C:\work" git-for-windows-issue cmd /c dir ..
Volume in drive C has no label.
Volume Serial Number is 464C-9AB1
Directory of C:\
11/22/2016 02:45 PM 1,894 License.txt
07/16/2016 05:18 AM <DIR> PerfLogs
12/24/2016 02:12 AM <DIR> Program Files
07/16/2016 05:18 AM <DIR> Program Files (x86)
12/24/2016 02:12 AM <DIR> Users
12/24/2016 02:12 AM <DIR> Windows
12/24/2016 02:06 AM <SYMLINKD> work [\\?\ContainerMappedDirectories\E5252A88-1539-401E-96FA-005C640978DB]
1 File(s) 1,894 bytes
6 Dir(s) 21,271,777,280 bytes free
It seems to me that Git is converting the UNC path into something and tries to switch to the "directory" ContainerMappedDirectories
.
Running in a Windows container with a volume mounted from the Windows Docker host works if I use a sub directory below that mount point:
PS C:\> cat .\test-subdir.ps1
if (!(Test-Path subdir)) {
mkdir subdir
}
cd subdir
git clone https://chromium.googlesource.com/external/gyp
PS C:\> docker run -v "$(pwd):C:\work" git-for-windows-issue powershell -file .\test-subdir.ps1
Directory: C:\work
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 12/24/2016 2:25 AM subdir
Cloning into 'gyp'...
Checking out files: 100% (1645/1645), done.
# back on the host:
PS C:\> dir .\subdir\
Directory: C:\vagrant\resources\dockerfiles-windows\git-for-windows-issue\subdir
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 12/24/2016 2:26 AM gyp
- What did you expect to occur after running these commands?
Git clone should work directly in the mounted volume directory. I encountered that problem trying to build and test libuv in a container on a mapped volume. They have a command to clone into a sub directory git clone https://chromium.googlesource.com/external/gyp build/gyp
but that also doesn't work if current dir in the container is the volume mount point.
- What actually happened instead?
fatal: Could not switch to '/ContainerMappedDirectories/': No such file or directory
- If the problem was occurring with a specific repository, can you provide the
URL to that repository to help us with testing?
No specific repo. But I have put this test scenario at https://github.com/StefanScherer/dockerfiles-windows/tree/master/git-for-windows-issue with the build and test scripts.
To build the Windows Docker image this Dockerfile
is needed
FROM microsoft/windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ENV chocolateyUseWindowsCompression false
RUN iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')); \
choco install -y git -params "/GitAndUnixToolsOnPath"
RUN git --version --build-options
RUN cmd.exe /c ver
RUN type 'C:\Program Files\Git\etc\install-options.txt'
# these install-options.txt files do not exist
# RUN type 'C:\Program Files (x86)\Git\etc\install-options.txt'
# RUN type ('{0}\AppData\Local\Programs\Git\etc\install-options.txt' -f $env:USERPROFILE)
# RUN cat /etc/install-options.txt
RUN mkdir C:\work
WORKDIR C:\\work
and then build the Docker image with
PS C:\> docker build -t git-for-windows-issue .