Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create subfolders for named volumes within the shared location #72

Open
ender74 opened this issue Sep 7, 2016 · 6 comments
Open

create subfolders for named volumes within the shared location #72

ender74 opened this issue Sep 7, 2016 · 6 comments

Comments

@ender74
Copy link

ender74 commented Sep 7, 2016

Right now, all the data for a named volume is written to the base directory of the share. Taking nfs for example. I do have an NFS share /export on my nfshost. Then running this:

docker volume create -d nfs --name data1 -o share=nfshost:/export
docker volume create -d nfs --name data2 -o share=nfshost:/export

will create two different named volumes (data1, data2). The data for both volumes will be stored in the same shared folder though (/export). The result is, that changes in one named volume can overwrite the data for the other too. To resolve such possible name clashes with the current version, I would need to define two different NFS shares /export1 and /export2. With many named volumes, this leads to many shares and greater administrative effort.

Proposal:

I propose to change the meaning of the share folder to be the root of a volume set (as suggested by @eesprit here: #52). This would mean, that for each named volume a subdirectory with the same name as the volume is created and all data stored there. For my example, this would lead to the following folder structure:

/export

  • /data1
  • /data2

Thus, the files for both named volumes are separated and I only have to create one NFS share. The same logic should be applied for cifs and probably efs.

It would be useful to define a new option to enable / disable this feature. If the option was named create, than the subfolders will only be created when -o create=yes is set. With -o create=no, the current behaviour remains and all files are stored within the root folder of the share. To be backward compatible, the default value for the create option could be no.

@gondor
Copy link
Member

gondor commented Sep 12, 2016

I like this and feel it adds more smarts to the driver and flexibility. I'm going to do some refactoring to support this and will make the next major upcoming release 1.0 to introduce this change.

@gondor gondor added this to the 1.0 Release milestone Sep 12, 2016
@manast
Copy link

manast commented Sep 15, 2016

strange, I thought this would also work, as long as the directory data1 exists in the proper location:

docker volume create -d nfs --name data1 -o share=nfshost:/export/data1

gondor added a commit that referenced this issue Oct 4, 2016
@gondor
Copy link
Member

gondor commented Oct 4, 2016

@manast @ender74 This feature has been created (only for NFS mounts). See example in latest release. It uses the create=true option as proposed.

https://github.com/ContainX/docker-volume-netshare/releases/tag/v0.30

@cardinalfan1
Copy link

Is this possible to do with a docker compose file?
I tried doing this, but doesn't seem to work:
volumes: nextcloud: driver: nfs driver_opts: share: 10.21.21.3:/data create: "true" nextcloud: image: nextcloud volumes: - nextcloud:/var/www/html/data:nocopy volume_driver: nfs depends_on: - mariadb

@ryanmickler
Copy link

Is this working for EFS volumes?

@joeknock90
Copy link

@cardinalfan1 I'd really like this ability in compose as well. Has anyone got that working or is this a current limitation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants