Windows 10使用Hyper-V的Docker映像和容器位置 [英] Docker images and containers location with Windows 10 using hyper-v

查看:465
本文介绍了Windows 10使用Hyper-V的Docker映像和容器位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到计算机中存储图像和容器的位置,我检查了,并在 Docker Root Dir 中使用 docker info,我有 / var / lib / docker ,但我在任何地方都找不到它,

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,

推荐答案

(这是WSL2的情况。)

(This is for case of WSL2.)

Docker映像由Docker自己的VM管理。由 docker info指定的路径/ var / lib / docker是相对于Docker的主机文件系统,而不是容器的文件系统。挂载点对于他们来说是不同的。您可以通过以下两种方式之一查看Docker的主机文件系统:

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. 您可以将主机文件系统挂载到容器目录。例如,

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

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

此命令运行Ubuntu镜像中的Shell,将docker的文件系统挂载到/ data目录。您可以在/ data下找到完整的文件系统,包括./var/lib/docker。如果需要,可以 chroot / data

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.

在WSL2中启用docker分配时,您始终可以在自己的容器中检查容器分发/ mnt目录。 Docker已为您安装了所有内容。

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



  • 如果经验丰富,可能会在Windows目录中找到所有数据的虚拟磁盘的实际位置。

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

    这篇关于Windows 10使用Hyper-V的Docker映像和容器位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆