Closed joaocc closed 8 years ago
suggestion:
driver_opts:
mountpoint: /data/my/good/folder
force_mkdir: true
mkdir_opts:
owner: user1
group: group1
mode: "u=rwx,o+rX"
I don't think Docker can write to the host?
Hi.
I believe that the current version behaves as "mkdir
So if you're using the plugin as a docker plugin, there are actually 2 places where the data for a volume lives: on the host and in the Docker local-persist
container.
If you see here: https://github.com/CWSpear/local-persist/blob/master/driver.go#L110, it does create (a la Go's mkdir -p
) the directory to make sure it exists. This is all that's needed if you run the plugin from the binary directly.
However, if run it as a Docker container, the container can't create volumes on the host, so you're responsible for creating those your self, i.e. the left side of a -v /path/on/host/:/path/on/local-persist/container/
during starting of the local-persist
container.
Now I understand it! :)
This just leaves me with another existential question... (let me know if you want me to add it in a separate ticket). (moved to https://github.com/CWSpear/local-persist/issues/36)
I think you've got this part, but gonna just reiterate: there are 2 ways to run this plugin:
+--------------------------------+ +-------------------------+
| Host runs local-persist binary |-------| App container(s) |
| [data needs to persist here] | | [data is mounted here] |
+--------------------------------+ +-------------------------+
The directory gets created here, everything should work out of the box in terms of creating directories, and nothing to worry about here.
But you're running the plugin in a container, which adds a layer:
+------------------------------+ +-------------------------+ +-------------------------+
| Host |-------| local-persist container |-------| App container(s) |
| [data needs to persist here] | | [data is mounted here] | | [data is mounted here] |
+------------------------------+ +-------------------------+ +-------------------------+
Either way, the data has to persist on the host. So when we create the local-persist
container, we need to link the actual data to that container so that when we think link a volume to an app container, it is getting the actual data (passed through the container).
Does that make sense...?
So local-persist
does create the directories, but in your case, it's creating the directories in the local-persist
container, and you still have to create a directory on the host, and make sure those directories are mapped together.
Thx. The answer you gave me is excellent for my original point. It would be useful for other users to have it in the readme.
As for my 2nd (additional) question, I will create a new issue to make it clearer.!
Hi, Have you thought of adding a feature/flag/mode to allow the creation of folder on the docker host when setting up the container and when mounting volumes? Currently, to use local-persist in docker-compose, I need to make sure the folders exist, which in turns requires an external script. Being able to have the folders create automatically in the docker host, we would have a smoother experience. Thx