docker-volume-netshare icon indicating copy to clipboard operation
docker-volume-netshare copied to clipboard

Docker-compose docs?

Open dbsanfte opened this issue 7 years ago • 4 comments

Are there any?

I see people doing things with cifs in their docker-compose like:

   driver: cifs 
   driver_opts:
      share: host.domain/share-name
      username: someuser
      password: somepassword 

The username and password options in the docker-compose aren't passed to the driver, though. They don't work. Only passing the username and password on the command line when starting the driver seems to. Otherwise I just get "mount exited with return code: 32".

I want to specify the username and password in configuration, not on the command line. The VM the driver is running on will be hosting many different docker containers referencing different shares on different hosts, with different username/passwords.

What fields are allowable under driver_opts for cifs (and for that matter, nfs etc)? Do I need to delve through the source to find out?

dbsanfte avatar May 10 '17 10:05 dbsanfte

hi @dbsanfte , I hope this could help you: http://netshare.containx.io/docs/cifs

pablolibo avatar May 18 '17 13:05 pablolibo

Thanks. Looks like the username/password aren't being passed down to the driver via my docker compose file, though. The only way it works is specifying creds on the command-line of the driver at runtime.

Using this to connect to an Azure File Storage share, but I don't think that should matter. It's Samba 3.

dbsanfte avatar May 19 '17 14:05 dbsanfte

I can confirm that from command line: docker volume create -d cifs --name vol1 -o share=host/sharename,username=***,password=*** works, as the username and password args are reflected in the plugin's mount execution (with --verbose flag).

DEBU[0873] Executing: mount -t cifs -o username=test,password=***,rw //host/sharename /var/lib/docker-volumes/netshare/cifs/vol1

But with compose file:

volumes:
    cifs-test-share:
      driver: cifs
      driver_opts:
        share: "host/sharename,username=test,password=test"

or

volumes:
    cifs-test-share:
      driver: cifs
      driver_opts:
        share: host/sharename
        username: test
        password: test

credentials are not passed through. (guest,rw appear to be default)

DEBU[0485] Executing: mount -t cifs -o guest,rw //host/sharename /var/lib/docker-volumes/netshare/cifs/storagetest_cifs-test-share 2017/07/26 15:28:56 mount: mounting //host/sharename on /var/lib/docker-volumes/netshare/cifs/storagetest_cifs-test-share failed: Invalid argument

jdessey avatar Jul 26 '17 18:07 jdessey

This began working after an upgrade to docker 17.06.0-ce.

volumes: cifs-test-share: driver: cifs driver_opts: share: host/sharename username: test password: test

Looking at the release notes, it may have been related to - https://github.com/moby/moby/pull/34194 although it references network driver opts as opposed to volume driver opts.

jdessey avatar Aug 02 '17 13:08 jdessey