58

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?

14 Answers 14

115

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
5
  • Yes, that's the path if you use Docker Desktop on WSL2 (Ubuntu), see : stackoverflow.com/a/64418064/6075581 Oct 22, 2020 at 19:43
  • Search for this path in windows explorer when docker engine is active
    – GRANZER
    Nov 24, 2021 at 16:10
  • Can we assume that the standard WSL warning of not editing WSL files through Windows File Explorer still holds for Docker containers?
    – j08691
    Feb 16, 2022 at 20:02
  • 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
    – mozboz
    May 27, 2022 at 9:12
  • In Docker Desktop version 4.13 its at "\\wsl.localhost\docker-desktop-data\mnt\wsl\docker-desktop-data\version-pack-data\community\docker\volumes" Mar 4, 2023 at 4:20
51

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
  • 9
    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.
    – rr789
    Dec 8, 2020 at 3:16
  • All I get inside that volumes folder is two files, backingFsBlockDev and metadata.db May 21, 2023 at 13:21
  • @MattFletcher What path are you using?
    – Rohaq
    May 28, 2023 at 0:07
20

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 direcotories:

enter image description here

5
  • 1
    The only right and working answer in 2022..!
    – buryo
    Jul 28, 2022 at 23:37
  • 1
    There is no such directory on docker community edition. Try \\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes as mentioned below. Aug 12, 2022 at 6:46
  • 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
    – Nick Wills
    Sep 15, 2023 at 13:28
  • Any idea how to get to \\wsl.localhost\docker-desktop-data\data\docker\volumes\abc\ _data using the WSL command prompt
    – Nick Wills
    Sep 15, 2023 at 13:37
  • Did you try /mnt/c/.... ?
    – DevWL
    Dec 2, 2023 at 17:09
17

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.)

12

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
  • 1
    If someone is looking for the volumes, these would then be located under /mnt/docker/data/docker/volumes
    – Maxi
    Apr 12, 2023 at 21:19
  • 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.
    – Ini
    Oct 11, 2023 at 1:52
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.

6

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
  • How can you query the docker server to return the right path? Jan 11, 2021 at 13:40
  • 5
    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. Jan 11, 2021 at 15:49
  • 1
    @Carlin'tVeld Same for me, I posted an answer with a solution found in the GitHub discussion.
    – AymDev
    May 19, 2022 at 15:19
  • 1
    Why would the wsl developers point the mount path to a different location than what docker volume inspect outputs? Horrible.
    – j7skov
    Jul 26, 2022 at 13:42
  • 1
    @j7skov maybe for persistence and consolidation of how docker runs inside wsl and in windows
    – 0x90
    Jul 26, 2022 at 14:01
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
  • 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. May 17, 2021 at 19:58
2

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

volume and other data in docker

1
  • 1
    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
    – Ben Ogorek
    Aug 21, 2020 at 15:46
2

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

1

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

1

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.

0

Windows 11 + WSL2

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

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)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.