菜单

Juning
发布于 2020-05-27 / 911 阅读
1
0

Docker (四点五) MacOS下/var/lib/docker 的存放位置

Docker版本:Docker version 19.03.8, build afacb8b

OS版本:10.15.4 (19E287)

学习docker的挂载时,想看一下挂载的是本机的哪个地址:

docker volume inspect ju_ming_gua_zai

查询到:

juning@chengjiajundeMacBook-Pro ~ % docker volume inspect ju_ming_gua_zai
[
    {
        "CreatedAt": "2020-05-26T13:54:30Z",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/ju_ming_gua_zai/_data",
        "Name": "ju_ming_gua_zai",
        "Options": null,
        "Scope": "local"
    }
]

然而Source这个地址在本机中并不存在:

juning@chengjiajundeMacBook-Pro ~ % cd /var/lib/docker/volumes/ju_ming_gua_zai/_data
cd: no such file or directory: /var/lib/docker/volumes/ju_ming_gua_zai/_data

在更新后的docker中应当使用:

screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty

进去之后默认是空白页面,需要按下Enter

docker-desktop:~# pwd
/root
docker-desktop:~# ls
docker-desktop:~# cd ../
docker-desktop:/# ls
EFI         dev         lib         proc        sendtohost  usr
bin         etc         media       root        srv         var
boot        home        mnt         run         sys
containers  init        opt         sbin        tmp
docker-desktop:/# cd var/lib/docker/
builder/     containers/  overlay2/    swarm/       volumes/
buildkit/    image/       plugins/     tmp/
containerd/  network/     runtimes/    trust/
docker-desktop:/# cd var/lib/docker/volumes/
docker-desktop:/var/lib/docker/volumes# ls
12ce0976bd5ec237ec8fdff01857e6ea864dbb5eba075dc0f57cd619ad0152b4
1c88bd0ae8b51f3efa366ea7f165cce99f68aeb9a583491a6503bc8f1c0f6434
8994961f4ecc6622cad6b421cb24ea40a9892c1d8dc676425f18e8200fb99d6a
d7423b28fbb062d15d3a3f4001f2f0aa210fe695dd50acc5ec5ff8fa79f39a5e
ju_ming_gua_zai
metadata.db

如果需要干掉这个screen,按ctrl+a + k,最后按y确认即可以kill掉这个screen了;

如果只是暂时退出这个screen,下次再进去,使用ctrl+a + d,而如果需要再次进入的时候应当使用screen -dr,否则使用screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty再进去会是一片乱码(+_+),所以我一般都是直接将screen干掉,放心,这并不会让挂载的卷丢失

玩docker还是得Linux啊


评论