75

I am running Windows Subsystem Linux (WSL) with Ubuntu as client OS under Windows 10. Now I installed Docker Desktop on the Windows host and enabled the WSL integration in the Docker settings. That works fine so far, I can access the Docker daemon running on the Windows host from my WSL Ubuntu client.

Now I am wondering where all the Docker volumes and other data is stored in this setup. Usually these are under /var/lib/docker, but it seems when using WSL this is not the case. When running df -h I can see the following Docker-related lines:

/dev/sdd        251G  3.1G  236G   2% /mnt/wsl/docker-desktop-data/isocache
/dev/sdc        251G  120M  239G   1% /mnt/wsl/docker-desktop/shared-sockets
/dev/loop0      244M  244M     0 100% /mnt/wsl/docker-desktop/cli-tools

So they are somewhere on the Windows host it seems.
... but where?

18 Answers 18

120

When I create a volume named shared_data in docker, I can find it under

\\\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\shared_data\\_data
Sign up to request clarification or add additional context in comments.

5 Comments

Yes, that's the path if you use Docker Desktop on WSL2 (Ubuntu), see : stackoverflow.com/a/64418064/6075581
Search for this path in windows explorer when docker engine is active
Can we assume that the standard WSL warning of not editing WSL files through Windows File Explorer still holds for Docker containers?
Note, this is not the same path as /mnt/wsl ... inside WSL, this is only the path as accessed from the Windows 'host' file system
In Docker Desktop version 4.13 its at "\\wsl.localhost\docker-desktop-data\mnt\wsl\docker-desktop-data\version-pack-data\community\docker\volumes"
55

You can find WSL2 volumes under a hidden network share. Open Windows Explorer, and type \\wsl$ into the location bar. Hit enter, and it should display your WSL volumes, including the ones for Docker for Windows.

3 Comments

To follow onRohaq's answer...paste this into Windows Explorer to see the data volumes: \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes PS. I am no Docker expert but this tip helped me greatly.
All I get inside that volumes folder is two files, backingFsBlockDev and metadata.db
@MattFletcher What path are you using?
36

Windows 10 + WSL2

I run docker-desktop on Windows 10 + WSL2. Just make sure you run the docker desktop, so the path would be accessible from a network.

I found my volume data under

\\wsl$\docker-desktop-data\data\docker\volumes

enter image description here

Note that you need to have docker desktop running before you will be able to discover those network directories:

enter image description here

However, according to the Docker documentation - [docs url]:

By default, Docker Desktop stores the data for the WSL 2 engine at C:\Users\[USERNAME]\AppData\Local\Docker\wsl. If you want to change the location, for example, to another drive you can do so via the Settings -> Resources -> Advanced page from the Docker Dashboard.

6 Comments

The only right and working answer in 2022..!
There is no such directory on docker community edition. Try \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes as mentioned below.
Thanks. using docker v4.23.0, yours is the only one that work currently. However, i don't understand. I do this docker volume inspect abc, the mountspoint show /var/lib/docker/volumes/abc/_data , but yet the actual location is \\wsl.localhost\docker-desktop-data\data\docker\volumes\abc\ _data. The portion of the path before the volumes not the same....wonder why
Any idea how to get to \\wsl.localhost\docker-desktop-data\data\docker\volumes\abc\ _data using the WSL command prompt
Did you try /mnt/c/.... ?
|
20

If you are wondering where on the Windows host the docker volumes are located, for me they seem to be at:

C:\Users\username\AppData\Local\Docker\wsl\data\ext4.vhdx

and

C:\Users\username\AppData\Local\Docker\wsl\distro\ext4.vhdx

presumably, these are docker-desktop-data and docker-desktop respectively.

In theory, these WSL2 instances can be re-located to an alternate drive to free disk space as per this post; that is the standard method for exporting, unregistering, and re-importing an instance from a new location. This process is also described here (with regard to standard WSL instances).

(Caveat - I haven't yet done this with the docker WSL2 instances yet myself, only for Ubuntu using the method in the second link.)

Comments

15

Most answers on this topic are about the location from the Windows side, I needed to access the container log files (the issue is the same as for volumes) from my WSL distribution, the Windows path \\wsl$ was not an option.

The files could be found on Windows in \\wsl$\docker-desktop-data\version-pack-data\community\docker\containers.
From the WSL distribution, I could go to /mnt/wsl/docker-desktop-data/version-pack-data but it was empty.

Finally found a solution here:

  1. From Windows, create a disk for docker-desktop-data:
net use w: \\wsl$\docker-desktop-data
  1. From your WSL distribution, mount it to docker:
sudo mkdir /mnt/docker
sudo mount -t drvfs w: /mnt/docker

Now you can get everything you want, in my case log files:

ls -l /mnt/docker/version-pack-data/community/docker/containers/

total 0
drwxrwxrwx 4 root root 512 May 19 15:06 3f41ade0891c06725e828853524d73f185b415d035262f9c51d6b6e03654d505

2 Comments

If someone is looking for the volumes, these would then be located under /mnt/docker/data/docker/volumes
wow, thank you very much, this was really helpful. I used this to get my gpg files into the container in order to do signing of commits from within a dev container.
10

Windows 11 + WSL2 + Docker Desktop

... and yet another example. I am running Windows 11 with WSL2 but also Docker Desktop v4.32 - I don't know if this is why the path is slightly different.

I haven't changed any defaults for Docker (not intentionally anyway!).

My experience:

I have SQL 2022 (Linux) image/container running which created a volume by default. I can now see that volume/data via straight Windows 11 File Explorer by using:

Folder Location:

\\wsl.localhost\docker-desktop\mnt

\\wsl.localhost\docker-desktop\mnt\docker-desktop-disk\data\docker\volumes

Docker Desktop Folder Windows 11

Might help someone along the way!

Comments

7

The volumes in the wsl2 kernel are mapped as follows:

docker run -ti -v host_dir:/app amazing-container will get mapped to /mnt/wsl/docker-desktop-data/data/docker/volumes/host_dir/_data/

The above is the right path, even though docker volume inspect amazing-container will tell you differently (/var/lib/docker/volumes/).

To conclude, the volumes are mapped to: /mnt/wsl/docker-desktop-data/data/docker/volumes/

6 Comments

How can you query the docker server to return the right path?
Well I would like to learn how to pull that data from the Docker server. In the meanwhile I found out that at my side the path is different: \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\myvol_data. Refer to github.com/microsoft/WSL/discussions/4176. Strangely when trying to reach out to his folder within wsl2 I find /mnt/wsl/docker-desktop-data/version-pack-data being empty.
@Carlin'tVeld Same for me, I posted an answer with a solution found in the GitHub discussion.
Why would the wsl developers point the mount path to a different location than what docker volume inspect outputs? Horrible.
@j7skov maybe for persistence and consolidation of how docker runs inside wsl and in windows
|
7

Docker Desktop's WSL2 feature creates two new wsl2 containers docker-desktop and docker-desktop-data, which can be seen by the command wsl -l -v

NAME                   STATE           VERSION
* Ubuntu-18.04           Running         2
  docker-desktop         Running         2
  docker-desktop-data    Running         2

This is where the docker daemon actually runs and where you can find the data you are looking for.

Comments

4

If you are running Docker on Windows host, using Docker Desktop, you can access the volumes at \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\ (search this path from windows explorer and make sure docker engine is running).

When running Docker desktop app, the app creates its own Linux VM or using WSL to run the docker container and the path /var/lib/docker/volumes/ is from within that VM I think. The volumes are created as mountable .vhdx file at

C:\Users\username\AppData\Local\Docker\wsl\distro\

but accessing this directly is tricky.

Ref: Google how to access WSl files from Windows

Comments

4

Updated Solution for Newer Windows and Docker Desktop: Following solution works for me date:10-6-2024, with following specs:

Docker Desktop Specs:

Docker Desktop 4.33

OS Specs:

windows 11 Pro, version 23H2, OS build 22631.4169

WSL Specs of test computer:

WSL version: 2.3.24.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.65 MSRDC version: 1.2.5620 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26100.1-240331-1435.ge-release Windows version: 10.0.22631.4169

You need to replace 'your-volume-name' with volume of your interest.

\\wsl.localhost\docker-desktop\mnt\docker-desktop-disk\data\docker\volumes\your-volume-name\_data

Comments

3

You can find volumes and others data when using docker with WSL under docker-desktop-data

volume and other data in docker

1 Comment

Mine didn't have host, but everything else is the same on my system. Once you get to the docker directory permissions are locked down. I did a sudo ls volumes to finally see my data
3

In my case, i install docker-desktop on wsl2, windows 10 home. i find my image files in

\\wsl$\docker-desktop-data\version-pack-data\community\docker\overlay2

All image files are stored there, and have been seperated into several folders with long string names. When i look into every folder, i can find all the real image files in "diff" folders.
Although the terminal show the path "var/lib/docker", but the folder doesn't exsit and the actual files are not stored there. i think there is no error, the "var/lib/docker" is just linked or mapped to the real folder, kind like that. In windows, we also use mklink to link two folders, it is similar, right?

1 Comment

Indeed, this is correct. The physical images and their layers are organized in this folder. But please note that they work together with /volumes folder as well.
3

Windows 10 + WSL2, Docker Desktop v4.13.1, free service tier, 2022-11-03: I found my volumes at \\wsl$\docker-desktop-data\data\docker\volumes

Comments

3

On Windows 11 and WSL2 (Ubuntu 22.04.2) the path shown in File Explorer is:

\\\wsl.localhost\docker-desktop-data\data\docker\volumes\my-volume\_data

You can browse to it by first typing in \\\wsl$ or \\\wsl.localhost on the search prompt.

Comments

2

Windows 10, WSL2, Debian 12, Docker Desktop 4.34.2.

Volumes are located at:

\\wsl.localhost\docker-desktop\mnt\docker-desktop-disk\data\docker\volumes

Comments

0

Windows 11 + WSL2

\wsl.localhost\docker-desktop-data\data\docker\volumes\mivolumen

Comments

0

I'll leave this here for other people looking for the path on the Linux distro used on WSL (Windows 11, Docker Desktop 4.20.1).

Given the Windows path: \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes (or \\wsl.localhost\docker-desktop-data\version-pack-data\community\docker\volumes)

It'll be found on the following path on the distro: /mnt/wsl/docker-desktop-data/version-pack-data/community/docker/volumes (requires sudo)

Comments

0

Windows11 24H2,WSL2,Docker Desktop 4.38.0:

\\wsl.localhost\docker-desktop\mnt\docker-desktop-disk\data\docker\volumes

1 Comment

Hello, your post need some basic explanation, please.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.