docker-volume-netshare: plugin can't handle volumes in docker-compose v2
We successfully used the plugin for nfs mounts with docker volume create, followed by docker run -v.
However with docker-compose we ran into a problem (http://jbu.io/2015/10/23/mount-nfs-efs-or-cifssamba-volumes-in-docker/#comment-2584967532).
As far as I understand we have the follwing problem: Given this docker-compose.yml file in a projectdir test:
version: '2'
volumes:
data:
driver: nfs
services:
some_service:
image: my_image
volumes:
- data:/mnt
docker-compose asks the plugin to create a volume test_data which in turn tries to mount something from a host test_data (which of course does not exist).
Solution would be to add a driver option to be used as follows
volumes:
data:
driver: nfs
driver_opts:
share: my.nfs.host:/path/to/share
Thus the plugin knows that the requested volume with name test_data refers to a share my.nfs.host:/path/to/share to be mounted under /var/lib/docker-volumes/netshare/nfs/my.nfs.host/path/to/share.
This way we are even compatible with mixed docker-compose and pure dockerclient runs.
BTW: an in advance docker volume created volume can be used the following way
volumes:
data:
external:
name: my.nfs.host/path/to/share
So instead my proposed option share: my.nfs.host:/path/to/share you might implement name: my.nfs.host/path/to/share
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 29 (26 by maintainers)
Commits related to this issue
- Issue #21 and #25 - Refactored to simplify and support 1.10 docker daemon better — committed to ContainX/docker-volume-netshare by gondor 8 years ago
- Merge pull request #28 from gondor/Issue21_25 Issue #21, #25 and #30 — committed to ContainX/docker-volume-netshare by gondor 8 years ago
I ended up doing a major refactor to simplify the same boiler plate between each driver. This binary and associated branch I checked into reflects this. I also added the share option.
For example:
This also works too (but noticed on my install daemon 1.10.3) wants the trailing /
CIFS and EFS inherited the NFS changes but I didn’t test… So test NFS then CIFS to compare. They all support the “share” option too
This refactor and binary also added the output on start to cover Issue #25 so can you close that is you are playing with this.
docker-volume-netshare-16.zip
@swoopster-sb I havn’t actually tested with swarm, however the proposed parameter
sharefordocker-compose filein my previous comment would perfectly solve your problem as well 😉