Closed joaocc closed 8 years ago
The purpose, as mentioned in #32, is to persist the data.
It will work, but the data will disappear after you destroy the local-persist
container without this.
Ok. I have to try it... But what is the relationship between "/path/to/where/you/want/data/volume/on/host" and "/data/images"?
Thx
They don't have to be related or a subfolder or anything.
You can store files anywhere on the host and map it to anywhere in the local-persist
container.
I generally will map them to the same directory, i.e. -v /data/images/:/data/images/
, but you could do /home/joaocc/Pictures/my-awesome-project/:/data/images/
.
In both cases, when creating a volume, the part on the right is what's important for the mountpoint
:
docker volume create --driver=local-persist --opt mountpoint=/data/images/ --name=my-images
But where the actual physical files will persist on the host, that's the left side.
Hi, I'm sorry to insist, but I am not sure I am explaining myself correctly. Let me give a concrete example.
docker run -d \
-v /run/docker/plugins/:/run/docker/plugins/ \
-v /path/to/store/json/for/restart/:/var/lib/docker/plugin-data/ \
-v /backups-on-host/general/:/all-backups/ \
cwspear/docker-local-persist-volume-plugin
docker volume create -d local-persist -o mountpoint=/backups-on-host/specific --name=bak-specific
...docker run ... -v bak-specific:/my-backups... some-container
From what I understood and what I tried on one of the older versions, -v /backups-on-host/general/:/all-backups/
didn't do anything.
Inside the some-container, I would only see a "/my-backups".
In this case, why would I need to add -v /backups-on-host/general/:/all-backups/
?
Thanks and once again I apologise for not having been clearer before.
The mountpoint
needs to be a subdirectory of the right side of the -v
in your local-persist
container, or the data won't persist.
docker volume create -d local-persist -o mountpoint=/all-backups/specific/ --name=bak-specific
(Or it could be the directory itself. /all-backups/
works for a mountpoint
, too)
I generally will map them to the same directory, i.e. -v /data/images/:/data/images/, but you could do /home/joaocc/Pictures/my-awesome-project/:/data/images/.
This doesn't work for me; because, when docker asks for the host path, the driver container returns "/data/images"; the file then ends up being stored on the host under the same path, not in /home
.
@miracle2k then just use -v /path/to/files:/path/to/files
(the same path on both sides).
@CWSpear That's what I am doing. I think the making an alias path work though would be a nice improvement; maybe by defining the "real" host path via environment variable.
All these questions are for container-mode :) What is the purpose of mapping a volume when starting the plugin...?
and have to do it again when using it...
The tests I made, I skipped the first -v
/path/to/where/you/want/data/volume/on/host/:/path/to/where/you/want/data/volume/
and all seemed to work well.I re-re-read the docs and I could not understand that. Thx