I'm running Docker on windows using WSL2. The docker data directory can be access from windows using this path:
\\wsl.localhost\docker-desktop-data\version-pack-data\community\docker
But when I try to access the same folder from WSL, I couldn't find it.
From the linux terminal, I can find the following directory:
/mnt/wsl/docker-desktop-data/version-pack-data
However, it's empty! it doesn't show community
folder or any other folders inside of it!
OS: Windows 11 build 10.0.22000.176 Docker: version 20.10.8, build 3967b7d Docker Desktop: Version 4.0.0
For some reason, you have to re-mount it on a different path like this:
net use h: \\wsl$\docker-desktop-data
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
Slightly older question dusted off by @ADJenks' answer, which certainly will work.
But IMHO a better solution is the one I detail in this Super User 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With