Reputation: 43
I run the docker for Windows and ubuntu in WSL. When I run the following command
docker volume create test
docker volume inspect test
I get the following output
[
{
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/test/_data",
"Name": "test",
"Options": {},
"Scope": "local"
}
]
when I access the location, I get
bash: cd: /var/lib/docker/volumes: No such file or directory
So how should I access the folder?
Upvotes: 3
Views: 8630
Reputation: 856
For me the volumes data are at /mnt/wsl/docker-desktop-data/version-pack-data/community/docker/volumes
, each distro may mount wsl
at different location, this is the default path for Ubuntu at least.
I can cd
into it with root
permission.
Upvotes: 0
Reputation: 2852
based on @nick's answer
sudo ls /mnt/wsl/docker-desktop-data/data/docker/volumes
\\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\docker\volumes
Upvotes: 2
Reputation: 1469
The directory is is protected so you can cd
into it, however you can ls
the contents:
sudo ls /wsl/docker-desktop-data/data/docker/volumes/test/_data
I've modified my WSL set up as per this article so you may find your path is different. I think the default path is probably /mnt/wsl/docker-desktop-data/data/docker/volumes/test/_data
You might find it more useful to mount a directory in your Windows user folder which can be done by changing the WSL mount point as per the article linked to above and then running:
docker volume create --driver local --name test --opt device=/run/desktop/mnt/host/c/Users/<username>/test --opt type=none --opt o=bind
(assuming you've got a folder called test
at the root of your Windows user directory)
Upvotes: 3