docker msys2: Too many levels of symbolic links

Viewed 2420

Running Docker version 20.10.8, using Windows containers, I am attempting to mount a local directory for use within a MSYS2 container (base is mcr.microsoft.com/windows:20H2, with MSYS2 installed at the usual location). I mount a local directory at z: when I run the container and launch MSYS bash, using the invocation:

docker run -v C:\path\to\dir:z: my:mingw-image C:\msys64\usr\bin\bash.exe -lc "ls /z/"

However, when I do so, I get the error:

ls: cannot access '/z/': Too many levels of symbolic links

Some digging (docker/for-win#109) has led me to believe that this has something to do with a bad interaction between how Docker mounts Z: and how MSYS symlinks work, but I'm not sure if I'm just doing something obviously wrong (X/Y problem maybe?) or if this is just how it is.

I can seemingly work-around by first copying the contents of Z: to another location (like C:\foo) but this slows down the container run pretty significantly (especially during development).

Any workarounds/suggestions/thoughts? The overall goal is to be able to run an MSYS2-based build in CI.

1 Answers
Related