I'm using Docker for mac and I want to find where are the volume created by Docker.
# Create volume
docker volume create --name volume-name
# Create container binding this volume
docker run -dti -v volume-name:/data --name deb debian:jessie
# Create a file in container:/data
docker exec -ti deb touch /data/test.txt
# Find the Mountpoint
docker volume inspect volume-name
# Get :
# [
# {
# "Name": "volume-name",
# "Driver": "local",
# "Mountpoint": "/var/lib/docker/volumes/volume-name/_data",
# "Labels": {},
# "Scope": "local"
# }
# ]
When I am using Docker on Linux, I can run
ls /var/lib/docker/volumes/volume-name/_data
and see the test.txt
file
But, on macOs I don't know where I can find this Mountpoint.
I found this post (Docker volume mount doesn't exist) but the author seems to use boot2docker and I'm not.
docker-machine ssh default
# Host does not exist: "default"
Can someone help me to find this Mountpoint on macOs using Docker for Mac
docker. docker/Data/vms/0/tty to get into the vm and then navigate to the folder to see the volumes.
Unlike bind mount, where you can mount any directory from your host, volumes are stored in a single location (most likely /var/lib/docker/volumes/ on unix systems) and greatly facilitates managing data (backup, restore, and migration).
I finally found the solution to get access of the linux virtual machine using docker for mac
sudo screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
cd /var/lib/docker/volumes/volume-name/_data
mv test.txt /Users/path/to/destination
By default some directories are shared (/Users, /Volumes, ...), Then I can move my data volume directory to my mac from the vm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With