3

I am trying to create docker volumes using the docker-volume-netshare driver from here: https://github.com/ContainX/docker-volume-netshare

The sequence should be like this:

docker volume create -d cifs <some_options>
docker run -v <the_volume> <other_docker_options>

and I can get it to work part of the way but for the life of me I can't get it to pass all the options I need.

Instead of trying to recount my countless different failure modes, I would prefer to state my goal. Underneath, docker-volume-netshare will execute a mount -t cifs ... command. This can be seen in the log when verbose is set to true.

This is the mount command that I am trying to get. I can get username and password in there, but only when using a .netrc file, and I have found no way to get the uid and gid into the command.

mount -t cifs -o username=myusername,password=mypasswd,uid=500,gid=499,rw //myserver.example.net/mysharename /the_mount_point/

So what I am looking for is the authoritative syntax for passing these options through docker-volume-netshare.

Mikkel
  • 163
  • 1
  • 2
  • 8
  • What did the developers say when you opened an issue on github? – Michael Hampton Sep 28 '16 at 07:02
  • I have not opened an issue on Github, because I thought that the issue tracker is for bug reports and feature requests, not requests for support. So far I am still thinking that I just need to learn how to do it right. – Mikkel Sep 28 '16 at 08:03
  • You should have opened an issue first, before coming here. Plus, this looks at first glance like missing functionality, which would require someone to implement. – Michael Hampton Sep 28 '16 at 08:54
  • 1
    Sorry, I was not able to determine that this looks like missing functionality. Are you saying that when I have a question/support request for a software product I should first open an issue on the issue tracker of that software? And if I have not done that, then my question is not welcome on serverfault? I know of some software projects where that approach would not be appreciated. Well, I guess it is just hard to please everyone! – Mikkel Sep 28 '16 at 08:57
  • This is a site for IT professionals, and as such we expect you to have done a minimum of attempting to resolve problems on your own. – Michael Hampton Sep 28 '16 at 17:21
  • 1
    I apologize for insulting you with my substandard question. You are a moderator, so please feel free to close my question. I will remember to bother the developers of a project first next time before I take the time of serverfault readers. – Mikkel Sep 29 '16 at 11:06

1 Answers1

7

A little bit late ... But here is the solution:

docker volume create \
     --driver local \
     --opt type=cifs \
     --opt device=//server.domain/path/to/share \
     --opt o=addr=server.domain,username=myuser,password=mypw,file_mode=0777,dir_mode=0777 \
     --name myvolume

In some situations the DNS-name did not work, this has been fixed in this PR and now domain names can be used by adding addr in the CIFS options. Using the option "credentials" instead of "username" an "password" did not work for me. I'm getting always the error "No username specified". From the shell (mount -t cifs //server/path -o credentials=/etc/cifs.cred /tmp/mnt) it works fine.

dmaj
  • 71
  • 1
  • 2
  • 1
    Did you find out in what situations the hostname resolution didn't work? – Jack Feb 18 '19 at 16:27
  • hi Jack, i have made an edit to the answer, needs to be approved by dmaj. You need to use the addr option (in the line where options are defined o= ) and specify the domain there. Docker will perform a getaddr from it and resolve the domain – Bizmate Feb 10 '21 at 08:38