In my setup, I’ve added a secondary harddisk (/mnt/disk2/) where I would like to store some named volumes.
I use the following command to create a named volume pointing to some folder there:
docker volume create --name jenkins-home --opt type=none --opt device=/mnt/disk2/docker-volumes/jenkins-home --opt o=bind
which seems to work so far.
Now what irritates me is that when I start the correpsonding container, all the data from
/mnt/disk2/docker-volumes/jenkins-home is then also visible in
/var/lib/docker/volumes/jenkins-home/_data. Are all data copied there upon startup of the container? Also as soon as I stop the container, the folder
/var/lib/docker/volumes/jenkins-home/ is emptied.
I also did some tests: When I modify/add something in any directory, it is immediately visible in the other directory as well. That sounds like a symlink but it does not show the
_data folder as symlink to
So how does it work then? Is really all data copied to the original volumes folder and some kind of sync running all the time? Or is there some other magic? If the data is just copied, I need to find another way to have the volumes on the second disk as the first one is too small. Also I do want to use named volumes so I can easily do backups with
Thanks for your information and help