2

I can't access docker-desktop-data in WSL2 with command wsl -d docker-desktop-data. I suspect that docker desktop(with WSL) stores there docker volumes which I want to look at. Interestingly that for other VMs this method(wsl -d <distroname>) works. Why is it different for docker-desktop-data?

1 Answer 1

2

As for why we can't access it via wsl -d docker-desktop-data, that appears to be because it has a 0 byte /init.

As for how to inspect it, I used wsl --export docker-desktop-data docker-desktop-data.tar and just examined the resulting tar file. I just recently installed Docker on Windows, so I haven't created any volumes yet to see if they are stored there.

Updated:

I don't believe this was possible at the time (but I'm not sure), but a better solution than exporting is:

$ 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

This will allow you to view docker-desktop-data as its original Ext4 filesystem, with symlinks and permissions intact.

3
  • Note, if you (or I) were using the Insider build of Windows, I believe it now has the ability to mount vhdx files (or, if not now, then soon), so we could in theory just mount that to examine it. Commented Dec 29, 2020 at 19:56
  • Also thinking, if we wanted to get really hacky, we might could delete the WSL instance, modify the tar (perhaps with a minimal shell), and reimport it back in under the same name. Commented Dec 29, 2020 at 19:59
  • 2
    I guess this (0 byte /init) happened recently, because a few months ago, I remeber, that it was possible "to go into" that VM. After installation of Docker Desktop I played a bit with it and it was interesting for me why 2 additional wsl distros were created, so inspected both of them
    – maks
    Commented Dec 29, 2020 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .