简体   繁体   中英

Docker images and containers location with Windows 10 using hyper-v

我无法找到图像和容器存储在我的机器中的位置,我检查了这个并使用Docker Root Dir 中的“docker info”我有/var/lib/docker ,但我无法在任何地方找到它,

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

他们住在C:\\ProgramData\\docker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM