Trouble with CIFS Mount
jamiejackson opened this issue · 4 comments
I struggled all day yesterday with this. Could you help me come up with a docker volume create
command that satisfies the following requirements?
Requirements
- type:
cifs
- username:
user1
- password:
user1pass
- share host:
localhost
- share directory:
private
- volume name:
mediashare
Equivalent Plain Mount
For what it's worth, here's the equivalent mount command (note the vers=3.0
option--that was necessary):
mount -t cifs -o username=user1,password=user1pass,vers=3.0 \
//localhost/private /tmp/mediashare
Failed Attempt
One of a hundred failed attempts:
Commands
nohup /mybin/docker-volume-netshare cifs --verbose=true &
docker volume create -d cifs \
--name mediashare \
--opt share=localhost/private \
--opt username=user1 \
--opt password=user1pass
docker run -it --rm -v mediashare:/tmp/mediashare -d --name samba-client alpine ash
Output from docker run
f3590287744080c6aee281ed4d61fe4476aed930030745e9736a592e4a78da94
docker: Error response from daemon: error while mounting volume '/var/lib/docker-volumes/netshare/cifs/mediashare': VolumeDriver.Mount: exit status 32.
Debug output
time="2017-11-12T15:48:11Z" level=warning msg="Error: open /root/.netrc: no such file or directory"
time="2017-11-12T15:48:11Z" level=info msg="== docker-volume-netshare :: Version: 0.18 - Built: 2016-05-27T20:14:07-07:00 =="
time="2017-11-12T15:48:11Z" level=info msg="Starting CIFS :: creds: { user=,pass=****,domain=,security= }, netrc: /root, opts: "
time="2017-11-12T15:48:11Z" level=debug msg="Entering Get: {mediashare map[]}"
time="2017-11-12T15:48:11Z" level=debug msg="Entering Get: {mediashare map[]}"
time="2017-11-12T15:48:11Z" level=debug msg="Entering Create: name: mediashare, options map[password:user1pass share:localhost/private username:user1]"
time="2017-11-12T15:48:11Z" level=debug msg="Create volume -> name: mediashare, map[password:user1pass share:localhost/private username:user1]"
time="2017-11-12T15:48:11Z" level=debug msg="Host path for mediashare is at /var/lib/docker-volumes/netshare/cifs/mediashare"
time="2017-11-12T15:48:11Z" level=debug msg="Entering List: { map[]}"
time="2017-11-12T15:48:12Z" level=debug msg="Entering Get: {mediashare map[]}"
time="2017-11-12T15:48:12Z" level=debug msg="Get: mount found for mediashare, host directory: /var/lib/docker-volumes/netshare/cifs/mediashare"
time="2017-11-12T15:48:12Z" level=info msg="Mount: mediashare, map[]"
time="2017-11-12T15:48:12Z" level=info msg="Mounting CIFS volume //localhost/private on /var/lib/docker-volumes/netshare/cifs/mediashare"
time="2017-11-12T15:48:12Z" level=debug msg="GetCreds: host=localhost, netrc=<nil>"
time="2017-11-12T15:48:12Z" level=debug msg="Executing: mount -t cifs -o guest,rw //localhost/private /var/lib/docker-volumes/netshare/cifs/mediashare\n"
2017/11/12 15:48:12 mount error(95): Not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount: mounting //localhost/private on /var/lib/docker-volumes/netshare/cifs/mediashare failed: Invalid argument
Software Versions
- docker-volume-netshare:
Version: 0.18 - Built: 2016-05-27T20:14:07-07:00
- docker:
Docker version 17.10.0-ce, build f4ffd25
Note to self: Samba server was created with:
docker run --rm -it \
-p 139:139 -p 445:445 -p 137:137/udp -p 138:138/udp -d \
--name samba -v /tmp/server-sharestore-volume:/private \
dperson/samba \
-n -u user1;user1pass -u user2;user2pass \
-s private;/private;yes;no;no;user1,user2;none;user1,user2
Solution
Get a more recent version of docker-volume-netshare
The documentation refers to a much older version (v0.18). If the documentation won't stay up to date, it should really mention to refer to https://github.com/ContainX/docker-volume-netshare/releases for updates.
I used this binary instead:
https://github.com/ContainX/docker-volume-netshare/releases/download/v0.34/docker-volume-netshare_0.34_linux_amd64-bin
docker volume create
Requirements
- type:
cifs
- volume name:
mediashare
- share host:
localhost
- share directory:
private
- username:
user1
- password:
user1pass
docker volume create \
-d cifs \
--name mediashare \
--opt share=localhost/private \
--opt username=user1 \
--opt password=user1pass \
--opt security=ntlm \
--opt cifsopts=vers=3.0
HIi @jamiejackson , i tried to do the same but i am getting this error.
'Error looking up volume plugin cifs: legacy plugin: plugin not found'. i did downloaded .34v of this one
@ramizrshaik, I'm not sure what step you're on.
First, what OS/version and Docker version are you running?
Next: Please run the following--verbatim for now--don't change any of the values to your own.
First terminal:
sudo pkill -f docker-volume-netshare # kill any extant processes
cd /tmp
wget -O docker-volume-netshare https://github.com/ContainX/docker-volume-netshare/releases/download/v0.34/docker-volume-netshare_0.34_linux_amd64-bin
chmod a+x ./docker-volume-netshare
sudo ./docker-volume-netshare cifs --verbose=true
Second terminal:
docker volume create \
-d cifs \
--name mediashare \
--opt share=localhost/private \
--opt username=user1 \
--opt password=user1pass \
--opt security=ntlm \
--opt cifsopts=vers=3.0
docker run -it --rm -v mediashare:/tmp/mediashare -d --name samba-client alpine ash
Then paste in the contents of your terminals.
@jamiejackson: I run into the same problem! Here is my log:
DEBU[0535] Executing: mount -t cifs -o vers=3.0,username='administrator',password='****',sec=ntlm,rw //192.168.21.14/test$ /var/lib/docker-volumes/netshare/cifs/mediashare
2018/05/14 14:18:02 mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
docker-volume-netshare: Version: 0.35 - Built: 2018-01-27T22:43:03-08:00
docker: Docker version 18.03.1-ce, build 9ee9f40
Edit: I solved the problem by removing the "cifsopts=vers=3.0" option