2

How to access the volume of a Docker Desktop app from Windows WSL2 bash? I can see the \\wsl.localhost\docker-desktop-data\version-pack-data\community\docker\volumes just right from Windows Explorer, but from WSL2 bash this folder /mnt/wsl/docker-desktop-data/version-pack-data listing results in an empty set.

I'm using Windows 11 Pro Version 10.0.22000 Build 22000

2 Answers2

2

Slightly older question dusted off by @ADJenks' answer, which certainly will work.

But IMHO a better solution is the one I detail in this answer. Since that's a fairly long read, I'll repeat it here. From inside a WSL2 distribution:

$ findmnt -a | grep "version-pack-data\s"
| |-/mnt/wsl/docker-desktop-data/version-pack-data        /dev/sdf[/version-pack-data]          ext4          rw,relatime,discard,errors=remount-ro,data=ordered
# Using the block device returned (sdf in this case):
$ sudo mount /dev/sdf /mnt/wsl/instances/docker-desktop-data -o X-mount.mkdir
$ cd /mnt/wsl/instances/docker-desktop-data

The advantage here is that you will be using the native Ext4 filesystem. Using drvfs will not provide native permissions, symlinks, and other POSIX features.

NotTheDr01ds
  • 17,574
  • 4
  • 44
  • 81
  • 1
    I don't get any results for `findmnt -a | grep "version-pack-data\s"`, my folder: "/mnt/wsl/docker-desktop-data/" contains "data" and "isocache", and "data" is empty but it's often where version-pack-data is found. If I `grep "docker-desktop-data"` instead, I do find a disk. Your method then works after that. – ADJenks May 04 '23 at 22:35
  • Perhaps you could describe this method on the github ticket that I linked in my answer, it might help people. – ADJenks May 04 '23 at 22:40
  • @ADJenks Thanks for that info - What's your Docker Desktop version? I was on 4.18 and I just updated to 4.19 -- I'm wondering if that's one of those things that have changed recently in the organization. If you are also on 4.18 or 4.19, then I'm going to need to keep searching for the "why" here ;-). – NotTheDr01ds May 04 '23 at 22:58
  • 4.13.1, I haven't updated in a while I guess. It hasn't bothered me to. – ADJenks May 04 '23 at 23:02
  • @ADJenks I'm the same way. I only updated recently because the HuggingFace Docker repo requires using the Beta `containerd` pull system in 4.18. Usually I'm *way* out of date. – NotTheDr01ds May 05 '23 at 00:30
1

For some reason, you have to re-mount it on a different path like this:

  1. In powershell:
net use h: \\wsl$\docker-desktop-data
  1. In wsl:
sudo mkdir /mnt/yourdockermount
sudo mount -t drvfs h: /mnt/yourdockermount

Source: https://github.com/microsoft/WSL/discussions/4176#discussioncomment-831817

The above worked for me. It was also suggested to do it in one step like so:

In wsl: sudo mount -t drvfs '\\wsl$\docker-desktop-data' /mnt/yourdockermount

Source: https://github.com/microsoft/WSL/discussions/4176#discussioncomment-1458301

ADJenks
  • 237
  • 2
  • 4