29

I installed docker-desktop for windows 10 from https://www.docker.com/products/docker-desktop, and I enabled the docker daemon for Linux container. I have my own wsl2 distro called ubuntu, and I enabled the docker-desktop integration with distro ubuntu, and built an image in it. But I cannot figure out where the image is saved. I did some search and found people saying it is in \\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data\docker. I did find this folder, but the whole folder is only a few hundred MB, and my image is several GB. I only find metadata in the folder but not the real image. Someone point out that I can find path to image in docker resources configuration tab, but mine does not show where the docker image is... docker resources

Any one has found the image in similar situation?

UPDATE the volumes are created in the folder: \\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\version-pack-data\community\docker\volumes

shelper
  • 10,053
  • 8
  • 41
  • 67
  • Something is not clear in your question : are you running Docker for Windows or Docker-ce in an Ubuntu virtual machine (which run on windows with a hosted hypervisor -like Virtual Box) ? In case of Docker for windows (Docker Desktop) does this answer to your question : https://stackoverflow.com/questions/42250222/what-is-docker-image-location-on-windows-10 – jossefaz Jun 15 '20 at 03:41
  • You can't directly access the contents of images from the host; the format they're stored in is opaque and can vary by installation. What are you looking for in this directory? – David Maze Jun 15 '20 at 09:40
  • @yAzou I updated my post. and i followed your link and my `docker info` gives root at `/var/lib/docker` but there is no such folder, only `/var/lib/docker-desktop` which is an empty folder. @DavidMaze it makes me feel safe if i know where the image stores. image size is not negligible.. – shelper Jun 15 '20 at 13:17
  • Have you tried the UI of Docker-desktop as explained in the first answer of the link ? It should show you the exact windows path where images are stored... – jossefaz Jun 15 '20 at 13:59
  • @yAzou my docker desktop does not show the path... i think maybe the older version does, but the one i downloaded yesterday does not. – shelper Jun 15 '20 at 14:10
  • I have seen this (it is what I'm getting now) – Indranil Gayen Nov 20 '20 at 21:35
  • Does this answer your question? [Where are Docker volumes located when running WSL using Docker Desktop?](https://stackoverflow.com/questions/61083772/where-are-docker-volumes-located-when-running-wsl-using-docker-desktop) – j08691 Feb 16 '22 at 20:03

3 Answers3

16

The Docker VM is stored in the file %USERPROFILE%\AppData\Local\Docker\wsl\data\ext4.vhdx.

This might not be what you're looking for, but I found this thread when looking for the linked one, so this answer might help some other people.

More info

The Bic Pen
  • 773
  • 6
  • 21
12

When using WSL integration, docker create two distros

  • docker-desktop
  • docker-desktop-data

You can access it by

\\wsl$\docker-desktop
\\wsl$\docker-desktop-data
Max
  • 6,821
  • 3
  • 43
  • 59
  • 1
    thanks for that, just to be more specific, it is located at `\\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\version-pack-data\community\docker\volumes` – shelper Aug 15 '20 at 17:39
  • 4
    Any idea what the difference between these two distros is? I am confused. – Nikki Apr 08 '21 at 15:30
10

Like Max says, Docker for WSL2 creates two distros docker-desktop and docker-desktop-data

After some digging around I finally about the layer data, and it's here: \\wsl$\docker-desktop-data\version-pack-data\community\docker\overlay2

There you can access the layer diffs (not the entire image because that's not how docker stores them), take note though that the folders aren't named after image id nor its repo digest. To find the correct folder you need to run docker image inspect image_id_here and look for GraphDriver.Data.UpperDir (or just run docker inspect image_id_here -f "{{.GraphDriver.Data.UpperDir}}") which will contain the folder name after /overlay2/.

Note: \\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\ is redundant, that same path can be simplified to just \\wsl$\docker-desktop-data\ (for some reason, some distros are mounted to themselves).

Hassan Selim
  • 151
  • 1
  • 5
  • Why are things in docker\overlay2 when everything I read says data should be saved to docker\volumes? Is there some setting I am not doing correctly? My docker\volumes is empty. – Nikki Apr 08 '21 at 15:31