title: Can I use Docker's Linux filesystem in WSL 2 to bind mount a directory instead of installing a Linux distro?
body: <p>I'm using Docker via WSL2 on Windows 10. I only want to be able to create Linux containers and map a directory in the container to a WSL directory.</p>
  <p>I'm pretty sure WSL must already have access to a Linux filesystem in order to create any container volumes used, so if I want to bind mount a directory can I use that filesystem instead of having to install and host an entire separate Linux distro?</p>
  <p>I've already found the filesystem Docker uses at \wsl$\docker-desktop and tried to bind mount directories in there, but not managed to get this to work.</p>
  <p>Does anyone know how to get this to work, or why it won't?</p>
  <p>UPDATE Here is a session of me creating a file in the WSL filesystem and bind mounting it into a Docker container. All commands complete without error, but it just doesn't work, inside the container no changes to the bind mount are detected.</p>
  <pre><code>:: Verify existing distros and default distro
  C:\Users\User&gt;wsl -l
  Windows Subsystem for Linux Distributions:
  docker-desktop (Default)
  docker-desktop-data
  
  :: Start wsl
  C:\Users\User&gt;wsl
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host/c/Users/User#
  
  :: View filesystem mounts
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host/c/Users/User# cd ../../../
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host# ls
  c    wsl
  
  :: Create a directory in the WSL filesystem to bind mount into a docker image
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host# mkdir wsl/test-dir1
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host# ls wsl
  docker-desktop       docker-desktop-data  test-dir1
  
  :: In a Windows CMD shell spin up a docker container with a bind mount to the created directory
  C:\Home&gt;docker run --rm -it --entrypoint bash -v //wsl$/test-dir1:/myapp node
  root@3a56694db873:/#
  
  :: In the container verify the bind mount is present - 'myapp' is there
  root@3a56694db873:/# ls
  bin   dev  home  lib64  mnt    opt   root  sbin  sys  usr
  boot  etc  lib   media  myapp  proc  run   srv   tmp  var
  
  :: Back in the WSL Bash prompt (NOT in the container) create a file in the supposedly mounted directory.
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host/wsl/test-dir1# echo Hi!! &gt; test1.txt
  DESKTOP-SDE0C3N:/tmp/docker-desktop-root/mnt/host/wsl/test-dir1# ls
  test1.txt
  
  :: In the interactive shell attached to the container verify that the created file is visible.
  root@3a56694db873:/# ls myapp
  root@3a56694db873:/#        &lt;-- test1.txt should be here!!!
  </code></pre>
  <p>The created file is not seen from within the container. The bind mount is not working.</p>