cli: Unable to create a docker volume with local CIFS driver

  • CentOS 7.4
  • Docker version 17.10.0-ce, build f4ffd25

I’m trying to create a volume with CIFS and a local driver.

Direct mounting works:

mount -t cifs -o username=user1,password=user1pass,vers=3.0 \
   //localhost/private /tmp/mediashare

Here’s my attempt with docker volume create:

 docker volume create \
   --driver local \
   --opt type=cifs \
   --opt device=//localhost/private \
   --opt o=username=user1,password=user1pass,sec=ntlm,vers=3.0 \
   mediashare

docker run -it --rm -v mediashare:/tmp/mediashare \
  -d --name samba-client alpine ash

However, here’s the output. The generic invalid argument error seems unhelpful.

docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/mediashare/_data': error while mounting volume with options: type='cifs' device='//localhost/private' o='username=user1,password=user1pass,sec=ntlm,vers=3.0': invalid argument.

References

This must be old information, since I don’t see a name argument for docker volume create:

I got it working with a plugin (docker-volume-netshare), but I want to try it without.

My Docker Forums post:

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 18

Commits related to this issue

Most upvoted comments

Appears to be working on ubuntu, docker 17.12.0. In my case I used --opt o=username=user,password=pass,iocharset=utf8,sec=ntlmssp,file_mode=0777,dir_mode=0777

EDIT with all options, to confirm I used IP address for the device: --driver local --opt type=cifs --opt device=//IP.ADDRESS.HERE/PATH

Anyone know why this only works with the IP address but not any sort of domain name?

I’m seeing the same issue as @jamiejackson when using a hostname and Docker 17.12.0-ce on Ubuntu and RancherOS hosts. Works fine if I use an IP Address instead as suggested by @radusuciu.

Seems this issue is specifically about being unable to create a volume using the local driver, type of cifs, and device of hostname?

Are all of those options necessary?

@shuchow There is currently a special case for resolving a domain name for type=nfs, if it we should do it for another type= then that’s do-able.

Closing since this is not really an error with docker. All docker is doing is passing these options to the kernel as is, the “invalid argument” error is coming from the kernel because the passed in options are not correct based on the cifs module that’s loaded in the kernel.

Thanks!

@radusuciu I’m not sure, just posted the options I used in their entirety just in case it can help.