docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 288 forks source link

Volumes Mount as Empty on Windows 19043 when Mounting Folders from Host over SMB #11427

Closed GuyPaddock closed 3 years ago

GuyPaddock commented 3 years ago

Actual behavior

After upgrading Windows to 19043, it no longer appears possible to launch a Docker container from inside WSL2 using a folder from a mounted SMB/CIFS2 as a volume inside the container (i.e. if a folder in Windows is C:\MyFolder, and I have mounted the C drive over SMB as /mnt/c-cifs, then I am trying to start a container inside WSL2 that has a volume mounted from /mnt/c-cifs/MyFolder).

Expected behavior

Previously, Docker for Windows was able to mount folders that live on SMB mounts inside WSL2 inside containers without issue.

Information

Steps to reproduce the behavior

  1. Install Docker for Windows.
  2. Following steps in https://www.liip.ch/en/blog/setup-drupal-and-lando-with-wsl2-on-windows, install Lando inside Ubuntu 20.04.2 LTS on WSL2 using Deb packages but manually remove the hard dependency on docker-ce so that it uses the version of Docker provided by Docker for Windows instead.
  3. Create a place for the C drive of the host system to be mounted (e.g. sudo mkdir /mnt/c-cifs).
  4. Mount the C drive of the host system over SMB using a script like this (customize USERNAME):
    
    HOST_IP=$(ipconfig.exe | grep WSL -A 4 | tail -n 1 | sed -E 's/.*: ([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\r?\n?/\1/')
    USERNAME="your.windows.username@example.com"

read -p "Windows password: " password

sudo mount -o username="${USERNAME}" -o password="${password}" -o uid=$(id -u) -o gid=$(id -g) -o vers=3 "//${HOST_IP}/c" /mnt/c-cifs/


5. Create the ["hello world" Lando project](https://docs.lando.dev/basics/first-app.html#hello-world) inside a folder mounted from the host over SMB (e.g. `/mnt/c-cifs/MyFolder`).
https://docs.lando.dev/basics/first-app.html#hello-world
6. Run `lando start` from within the hello-world project folder (e.g. `cd /mnt/c-cifs/MyFolder && lando start`)

The application will either fail to start with the error about "not a directory" or it will start but only serve-up "404 page not found".
GuyPaddock commented 3 years ago

Closing out -- this looks like a Lando issue. Here's why:

GuyPaddock commented 3 years ago

For others running into this issue:

I reached the conclusion that resetting Docker might fix the problem when I observed that the Drupal 7 Lando recipe was mounting the SMB-hosted folder as a volume via a named mount like the following:

/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu/1644e8b45b13530a823cabcef28cf8bc95190569e8f80b73be6763e0c4e4d5c4:/app:cached

While my other Lando app was mounting it as:

/mnt/c-cifs/MyFolder

So I concluded that perhaps Docker had something cached or conflicting that was preventing it from translating that path to a bind mount internally.

docker-robott commented 3 years ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked