May 23, 2017 · Updated: Feb 05, 2020 · by Tim Kamanin
If you use persistent data volumes in Docker, you might want to access them via command-line. If your docker host is Linux, that's not a problem; you can find Docker volumes by /var/lib/docker/volumes path.
However, that's not the case when you use Docker for Mac. Try to cd
/var/lib/docker/volumes
from your MacOS terminal, and you 'll get nothing.
You see, your Mac machine isn't a real Docker host. Docker for Mac runs a
virtual machine behind the scenes and hides it from you to make things
simpler. Simpler, unless you want to dig deeper.
So, to access persistent volumes created by Docker for Mac, you need to log in that hidden virtual machine first, which is not that straightforward.
In order to accomplish this, we need to use a serial terminal on Mac. There's a terminal application called "screen" that's going to help us.
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
docker-desktop:~#
cd /var/lib/docker/volumes
Hope this helps someone!
Hey, if you've found this useful, please share the post to help other folks find it: