Docker Community Forums

Share and learn in the Docker community.

Where is the default Volume location

docker
beta

(Sgandon) #1

this more a question than a bug.
when I do
docker run --name foo -v /bar -i -t ubuntu bash
and then
docker inspect foo
I have the Mounted volume source directory set to
/var/lib/docker/volumes/81ebb09e123c34698ddce2d8902c746ab4e1a54cacf86b216ec3ce97e8b95f5e/_data
which does not exists.
So I would like to know where on my host can I find the mounted volume please ?


(Alexandre) #2

Hi,

This path resides on the Docker host VM (the Alpine Linux ran by xhyve).

You can use screen to jump in the host:

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty  
#user: root
#password: <none>
$ ls -ltrh /var/lib/docker/volumes
total 148
drwxr-xr-x    3 root     root          4096 May 16 13:20 04576d248c19b1210d47e94c8211493428cd3c3aa71dfe3fa0f4214589a6f875
drwxr-xr-x    3 root     root          4096 May 16 13:20 31af0f01492d8f7b832dad75e731b754302e84fbecfa7c654d7de10465bec204
drwxr-xr-x

Or you can also use gesellix trick from this thread to mount a directory from your Mac and the /var/lib/docker one from the VM to easily move files between the two:

docker run --rm -it -v /Users/<username>/volume-backup:/backup -v /var/lib/docker:/docker alpine:edge tar cfz /backup/volumes.tgz /docker/volumes/

HTH,
Alexandre