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
  • 28,025
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
  • 337
  • 3
  • 5