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

How to use with docker-compose #49

Open
hwaterke opened this issue Jul 12, 2016 · 6 comments
Open

How to use with docker-compose #49

hwaterke opened this issue Jul 12, 2016 · 6 comments

Comments

@hwaterke
Copy link

I find it strange that the cifshost/share is taken from the name of the volume and not a driver option.
This makes it unusable with docker-compose.

version: '2'
volumes:
  data:
    driver: cifs
    driver_opts:
      username: some_username
      password: some_password
services:
  foo:
    image: ubuntu
    command: ls -la /data
    volumes:
      - "data:/data"

which results in the following error:

INFO[0020] Mounting CIFS volume //sharetest_data on /var/lib/docker-volumes/netshare/cifs/sharetest_data 
2016/07/12 13:29:32 mount error: could not resolve address for sharetest_data: Unknown error

Could you add a driver option to override the cifshost and share?

@holgerreif
Copy link
Contributor

It's already available:

    driver_opts:
      share: host:/share

@hwaterke
Copy link
Author

hwaterke commented Jul 12, 2016

Thanks for the quick reply.

Unfortunately I still have the same issue...

version: '2'
volumes:
  data:
    driver: cifs
    driver_opts:
      share: "//192.168.42.10/downloads"
      username: usr
      password: pwd
services:
  foo:
    image: ubuntu
    command: ls -la /data
    volumes:
      - "data:/data"

(same with share: "192.168.42.10:/downloads")

INFO[0003] Mounting CIFS volume //sharetest_data on /var/lib/docker-volumes/netshare/cifs/sharetest_data

Are those other options documented somewhere?
I would also like to pass 'ro' in order to mount in read-only

Update:
It seems there is a caching issue somewhere.
When creating a new docker-compose.yml file, it seems to work but after that any docker-compose up goes back to using the name of the volume for the share.
Do I need to cleanup something?

@holgerreif
Copy link
Contributor

holgerreif commented Jul 13, 2016

Are those other options documented somewhere?

The best doc is @ http://netshare.containx.io/docs/cifs.
All options to be passed by docker volume create command line are available within docker compose

When creating a new docker-compose.yml file, it seems to work but after that any docker-compose up goes back to using the name of the volume for the share.

This sounds like a docker-compose issue... Which version are you using?

Could you provide the logs of the docker-volume-netshare running with debug flag?
Furthermore the output of docker volume ls after each attempt might be helpfull.

Hint: before you run any command on the commandline run logger -t issue49 "Doing XYZ" making it easier to correlate commands and debug output in logs

@pauldotknopf
Copy link

I know this is old, but I am experiencing this issue as well.

pknopf@ubuntu:~$ sudo docker-volume-netshare cifs --verbose=true
WARN[0000] Error: open /home/pknopf/.netrc: no such file or directory 
INFO[0000] == docker-volume-netshare :: Version: 0.18 - Built: 2016-05-27T20:14:07-07:00 == 
INFO[0000] Starting CIFS :: creds: { user=,pass=****,domain=,security= }, netrc: /home/pknopf, opts:  
DEBU[0251] Entering Get: {docker_data map[]}            
DEBU[0251] Entering Get: {docker_data map[]}            
DEBU[0251] Entering Create: name: docker_data, options map[password:*** share:192.168.5.5/atlassian username:pknopf] 
DEBU[0251] Create volume -> name: docker_data, map[password:*** share:192.168.5.5/atlassian username:pknopf] 
DEBU[0251] Host path for docker_data is at /var/lib/docker-volumes/netshare/cifs/docker_data 
DEBU[0251] Entering Get: {docker_data map[]}            
DEBU[0251] Get: mount found for docker_data, host directory: /var/lib/docker-volumes/netshare/cifs/docker_data 
DEBU[0266] Entering Get: {a1faa9b27c3a6b75b7adc151de2dc71a7621268d15dc1c65fac656a14df0b601 map[]} 
INFO[0266] Mount: docker_data, map[]                    
INFO[0266] Mounting CIFS volume //192.168.5.5/atlassian on /var/lib/docker-volumes/netshare/cifs/docker_data 
DEBU[0266] GetCreds: host=192.168.5.5, netrc=<nil>      
DEBU[0266] Executing: mount -t cifs -o guest,rw //192.168.5.5/atlassian /var/lib/docker-volumes/netshare/cifs/docker_data
 
2017/01/21 22:21:22 mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
version: '2'
volumes:
  data:
    driver: cifs
    driver_opts:
      share: 192.168.5.5/atlassian
      username: pknopf
      password: ***

@dbsanfte
Copy link

dbsanfte commented May 10, 2017

I'm not convinced the username/password options pass through to the driver. I am able to get this working with a username/password if I launch docker-volume-netshare with the username/password for the share on the command line, but not if I pass them in via those username/password options in docker-compose.

This makes configuration-driven authentication impossible and feels like a bug. :(

@alusvedejs
Copy link

Hi!
sorry for resurrecting old thread, but is there a way how to provide default options on startup?

i mean this is working:
docker volume create -d nfs --name myvol6 -o share=10.4.1.44:/container_storage/ -o create=true docker run -it --rm --volume-driver=nfs -v myvol6:/data ubuntu:trusty

however i would like to hide the infrastructure details from the developers and somehow move -o share=10.4.1.44:/container_storage/ -o create=true to plugin defaults by adding options at plugin startup.

does that make sense?
tried to add to environment file
DKV_NETSHARE_OPTS="nfs -o share=10.4.1.44:/container_storage/ -o create=true"
but probably spelling has to be different.a

any suggestions?

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