我正在寻找Mac上安装docker for Mac后的/var/lib/docker文件夹。
与码头信息我得到
Containers: 5
...
Server Version: 1.12.0-rc4
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 339
Dirperm1 Supported: true
...
Name: moby
ID: LUOU:5UHI:JFNI:OQFT:BLKR:YJIC:HHE5:W4LP:YHVP:TT3V:4CB2:6TUS
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
....
但是我的主机上没有/var/lib/docker目录。
我已经检查了/Users/myuser/Library/Containers/com.docker。Docker /但是在那里什么也找不到。知道它在哪里吗?
到2021年,Mac用户可以很容易地使用文档化的方法访问VM,从而访问卷。
Rocky Chen找到了一种方法来进入Mac中的VM。通过这个方法,你可以检查著名的/var/lib/docker/volumes.
Docker运行-it——privilege——pid=host debian nsenter -t 1 -m -u -n -i sh
让我们来看看这个方法:
-it goes for Keep STDIN open even if not attached + Allocate pseudo-TTY
--privileged "gives all capabilities to the container. Allows special cases like running docker" .
--pid defines to use the host VM namespace.
debian the actual image to use.
nsenter a debian's tool to run programs in different namespaces
-t is the target PID
-m mount the provided PID namespace.
-u enter the Unix Time Sharing (UTS) namespace.
-n enter the provided PID network namespace.
-i enter the provided PID IPC namespace.
运行后,转到/var/lib/docker/volumes/,你会找到你的卷。
我的下一个问题是:
如何获取这些卷并将它们备份到主机中?
我很欣赏评论中的想法!
为vscode用户更新
如果你下载了官方Docker扩展,太阳将为你照耀。
只需检查Visual Studio Code中的卷即可。右键单击您想要保存在本地的文件,并下载它们。那么容易!
2日更新
2021年7月,Mac版Docker Desktop宣布,我们将能够直接从GUI访问卷,但仅限于专业和团队帐户。
我会说这个文件:
/var/run/docker.sock
实际上是:
/Volumes/{DISKNAME}/var/run/docker.sock
如果你运行这个,它应该证明它,只要你运行的是VirtualBox 5.2.8或更高版本,/Volumes的共享设置为自动挂载和永久的,并且你在该版本的VirtualBox上生成了默认的docker-machine:
#!/bin/bash
docker run -d --restart unless-stopped -p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock portainer/portainer \
--no-auth
然后通过192.168.99.100:9000或localhost:9000访问Portainer
到2021年,Mac用户可以很容易地使用文档化的方法访问VM,从而访问卷。
Rocky Chen找到了一种方法来进入Mac中的VM。通过这个方法,你可以检查著名的/var/lib/docker/volumes.
Docker运行-it——privilege——pid=host debian nsenter -t 1 -m -u -n -i sh
让我们来看看这个方法:
-it goes for Keep STDIN open even if not attached + Allocate pseudo-TTY
--privileged "gives all capabilities to the container. Allows special cases like running docker" .
--pid defines to use the host VM namespace.
debian the actual image to use.
nsenter a debian's tool to run programs in different namespaces
-t is the target PID
-m mount the provided PID namespace.
-u enter the Unix Time Sharing (UTS) namespace.
-n enter the provided PID network namespace.
-i enter the provided PID IPC namespace.
运行后,转到/var/lib/docker/volumes/,你会找到你的卷。
我的下一个问题是:
如何获取这些卷并将它们备份到主机中?
我很欣赏评论中的想法!
为vscode用户更新
如果你下载了官方Docker扩展,太阳将为你照耀。
只需检查Visual Studio Code中的卷即可。右键单击您想要保存在本地的文件,并下载它们。那么容易!
2日更新
2021年7月,Mac版Docker Desktop宣布,我们将能够直接从GUI访问卷,但仅限于专业和团队帐户。