Symptom:
If we want to access the volume location on the host machine, we normally inspect the volume to get the location on the host machine:
$ docker volume inspect todo-db|grep Mountpoint
"Mountpoint": "/var/lib/docker/volumes/todo-db/_data",
For Linux host machine, it is straightforward.
But for Mac, the Docker commands are running inside a small VM. So we normally use below command to login Docker's VM on Mac firstly:
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
However in latest Docker Desktop for Mac version, "tty" does not exist so it will fail to login.
Env:
Docker Desktop for Mac 20.10.3
MacOS Catalina
Root Cause:
This issue is recorded as a bug.
This stackoverflow discussion though this issue is since version 2.3.0.4 of Docker Desktop for Mac.
Solution:
Below the issue is fixed, use below workaround instead:
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
And then we can see the volume location on host:
/ # ls -altr /var/lib/docker/volumes/todo-db/_data
total 16
drwx-----x 3 root root 4096 Mar 3 21:40 ..
-rw-r--r-- 1 root root 8192 Mar 3 21:42 todo.db
drwxr-xr-x 2 root root 4096 Mar 3 21:42 .
No comments:
Post a Comment