Docker Community Forums

Share and learn in the Docker community.

SMB / CIFS Share Permission Denied with Volume Mount

Might be a bug or am I missing something?

RedHat 7 host OS.

mount -t cifs --source “//server1/data/EE1Z/Reviews” --target /mnt/smb/fdlrr -o credentials=/home/ops/service/wpmg.smbpw,dir_mode=0777,file_mode=0777,gid=556,uid=12522 -rw

Which mounts the Windows share wonderfully under /mnt/smb/fdlrr and the user account “service” can read and write to it.

drwxrwxrwx. 2 service ops 0 Apr 12 16:04 fdlrr

Docker container is being mounted with the following:

docker run -m 1G --memory-reservation 128M --env-file /opt/server/reviews/server/.env --detach --restart=on-failure:10 --publish 1974:2222 --volume /opt/server/reviews/server/:/server:z --volume /logs/webapps/reviews:/home/node/app/logs:z --volume /mnt/smb/fdlrr:/home/node/app/reviews/reports:z --name reviews myrepo/reviews:version.001

~/app/reviews
$ cd reports/
sh: cd: can’t cd to reports/: Permission denied

drwx------ 2 root root 160 Apr 12 23:37 reports

I should mention the container writes to /logs/webapps/reviews beautifully.

Updating docker to the latest CE seems to have done the trick!

I could overcome the error with mount -t cifs … simply add the parameter sec=ntlmsspi to the options. Other possible options are:

ntlmssp
ntlmv2
ntlmv2i
I was able to create a mount point with autofs by following the hint number 4 from this site

Some changes needed to be made to /etc/auto.mymount The option sec must be specified. I found the correct parameters here (at the very bottom of the page)

My /etc/auto.mymount ended up containing one line which is:

share -fstype=cifs,rw,noperm,user=ESBSertal,pass=MyPassword,domain=ESB,sec=ntlmsspi ://esb.local/dfs
executing service autofs restart renews the information.

this allowed me to access the contents of the share under /mnt/win/share