如何在Windows 10 Docker桌面中访问/ var / lib / docker? [英] How to access /var/lib/docker in windows 10 docker desktop?

查看:960
本文介绍了如何在Windows 10 Docker桌面中访问/ var / lib / docker?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 为Windows 10安装docker桌面

  2. 使用Powershell运行docker容器(ubuntu)

  3. 现在,我想要浏览到/ var / lib / docker->想要浏览到overlay2以检查图层.. / diff文件夹等。

  4. 如果我访问/ var / lib / docker文件夹- powershell抱怨此文件夹不存在。

  1. Installed docker desktop for windows 10
  2. Used powershell to run docker containers ( ubuntu )
  3. Now, I want to browse to /var/lib/docker --> want to browse to overlay2 to check layers.. /diff folder etc.
  4. If i access /var/lib/docker folder - powershell complains that this folder does not exist.

其他信息:我已经签出了映射到的磁盘映像位置docker桌面。这是一个vhdx文件。
我无法使用Oracle虚拟框打开它-它说它不是受支持的版本文件。
我尝试在Hyper V管理器中打开,该虚拟机正在列出:DockerDesktopVM。

Other piece of info: I have already checked out the disk image location which is mapped for docker desktop. It is a vhdx file. I was not able to open it with Oracle virtual box - it says it is not a supported version file. I tried opening in Hyper V manager, the VM is getting listed: DockerDesktopVM.


  • 但是我的目标是执行SSH和浏览/ var / lib / docker文件夹。.

推荐答案

(这是WSL2的情况。这是我答案(类似问题)

(This is for case of WSL2. It is my answer to a similar question)

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 Docker桌面中访问/ var / lib / docker?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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