In short, when I try to use a Windows directory as a volume or bind mount in WSL 2 with Docker Desktop integration, it just mounts an empty directory instead of the source directory. I do not see this issue in WSL 1.
I do not have a firewall installed in my WSL 2 Ubuntu distro, but Windows Firewall is up. I wasn’t aware previously but doing some searching it looks like the way Windows files are shared with WSL2 is via a Plan 9 fileshare, which is apparently a network protocol. So I guess it is plausible that Windows Firewall may be blocking that, thanks for the suggestion @tekki . What I can’t find in some quick google searches is how to enable the traffic (i.e. which ports to allow). I would just turn off the firewall temporarily to see if that fixed it, but that appears to be blocked by group policy so I’d have to get someone in IT to help me with that. Short of that, does anyone know what ports for which I can try adding allow rules to the firewall to try to get this to work? Also, would it be expected to immediately start working once firewall rules are added or the firewall is turned off, or would I need to restart WSL and/or Docker Desktop to get any handshakes done to establish the connection once it was unblocked?
I just got IT to disable the firewall entirely, and restarted WSL and Docker Desktop to be sure that any connections/initialization that would need to be done by the Plan 9 fileshare would be done without any potential interference from a firewall, but am still seeing the same behavior, it just mounts an empty directory when I do the docker run command from WSL 2.