MacOS下/var/lib/docker 的存放位置

Docker版本:18.09.2, build 6247962
OS版本:MacOS Mojave 10.14.3

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

docker run -d --name test-nginx -v /usr/share/nginx/html nginx
docker inspect test-nginx

查询到:

...
        "Mounts": [
            {
                "Type": "volume",
                "Name": "83af3ea2681490a5804183e427da3aa50241e31d1a39145b082b5aeca945a6f7",
                "Source": "/var/lib/docker/volumes/83af3ea2681490a5804183e427da3aa50241e31d1a39145b082b5aeca945a6f7/_data",
                "Destination": "/usr/share/nginx/html",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
...

然而Source这个地址在本机中并不存在,在更新后的docker中应当使用:

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

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

linuxkit-025000000001:/# pwd
/
linuxkit-025000000001:/# ls
EFI         dev         lib         proc        sendtohost  usr
bin         etc         media       root        srv         var
boot        home        mnt         run         sys
containers  init        opt         sbin        tmp
linuxkit-025000000001:/# ls /var/lib/docker/volumes/83af3ea2681490a5804183e427da
3aa50241e31d1a39145b082b5aeca945a6f7/_data
50x.html    index.html
linuxkit-025000000001:/#
  • 如果需要干掉这个screen,按ctrl+a + k,最后按y确认即可以kill掉这个screen了;
  • 如果只是暂时退出这个screen,下次再进去,使用ctrl+a + d,而如果需要再次进入的时候应当使用screen -dr,否则使用screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty再进去会是一片乱码(+_+),将这个screen干掉即可

你可能感兴趣的:(MacOS下/var/lib/docker 的存放位置)