3

I am unable to find the location where images and containers are stored in my machine, i checked this and with 'docker info' in Docker Root Dir i have /var/lib/docker , but i'm unable to find this anywhere,

MrSir
  • 576
  • 2
  • 11
  • 29
  • Does this answer your question? [How to access /var/lib/docker in windows 10 docker desktop?](https://stackoverflow.com/questions/60408574/how-to-access-var-lib-docker-in-windows-10-docker-desktop) – Metro Smurf Oct 31 '22 at 20:04

2 Answers2

1

They live under C:\ProgramData\docker

Colm Prunty
  • 1,595
  • 1
  • 11
  • 29
  • 2
    I'm sorry i am new to this but under that folder i have different `service.txt` files which look like log files, in total they weight 300KB, i have downloaded mongodb and other heavier stuff using docker, i should have at least 1GB of data. – MrSir Oct 31 '17 at 16:45
  • Are you running a Linux container? If so, Windows will be running it in a VM, and the folder will be in that VM under the folder you've mentioned. – Colm Prunty Oct 31 '17 at 21:16
  • I have MobyLinuxVM within hyper-v, all hyper-v data is installed under c:\windows. – MrSir Oct 31 '17 at 21:23
  • Your containers will be on that VM, you'll have to SSH in to see them. – Colm Prunty Oct 31 '17 at 22:01
  • ok, i managed to trasnfer the data from the vm to a local folder via hyper-v manager, thanks. – MrSir Oct 31 '17 at 23:59
  • Hi, i am a beginner in Docker. My Docker info states the same path /var/lib/docker and I tried to find it in my VM but there is no docker in my /var/lib. I am using windows 10, and linux container. – Zuha Karim Dec 16 '19 at 14:16
1

(This is for case of WSL2.)

Docker images are managed by docker's own VM. The path /var/lib/docker given by "docker info" is relative to docker's host file system, not your container's file system. The mount points are different for them. You can view docker's host file system in either of the following ways:

  1. You can mount the host file system to a container directory. Such as,

    docker run -v /:/data -it ubuntu /bin/bash

    This command runs a shell in Ubuntu docker image, mounting docker's file system to /data directory. There you can find a complete file system under /data, including the ./var/lib/docker. If you want, you can "chroot /data" in the shell prompt to have a better view.

  2. When docker is enabled with your distribution in WSL2, you can always check your containers in your distribution /mnt directory. Docker has mounted everything for you.

    /mnt/wsl/docker-desktop-data/data/docker
  3. If you are seasoned enough, you may find the actual location of the virtual disk of all the data in your Windows directory.

    C:\Users\your_name\AppData\Local\Docker\wsl\data\

    Or probably just for fun:

    \\wsl$\Ubuntu\mnt\wsl\docker-desktop-data\data\docker

    Unfortunately I haven't tried to dive into them.

Xiao-Feng Li
  • 680
  • 7
  • 12