Docker Community Forums

Share and learn in the Docker community.

How to access / mount Windows filesystem in WSL 2 mode?

docker Windows v.19.03.13 / Windows 10 Pro v2004 (19041.508) clean install of both from scratch.

Everything seems to work fine, but I can’t figure out how to access the Windows file system. There is no file sharing tab in Docker Desktop Settings, as expected because WSL 2 is checked.

The documentation [] says that “…in WSL 2 mode and Windows container mode all files are automatically shared by Windows”.

I cannot find any examples in the documentation.

If I run a ubuntu container, the /mnt and /media directories are empty, and nothing relevant is shown by ‘mount’ as far as I can tell.

I’ve tried variations of -v and --mount with no success, typically I get errors like “Error response from daemon: invalid mount config for type “bin.source=e:” mount type unknown”.

Can someone provide or link to examples that show how to bind-mount, or otherwise access, Windows files from a container, showing how to deal with Windows specific issues such as drive letters and backslashes?

The easiest is like this:

PS C:\Users\xy> docker container run --rm -it -v "$(pwd):/data" debian bash

Mounts the current folder into /data in a Debian container and opens a bash shell.