Docker Community Forums

Share and learn in the Docker community.

Create CIFS volume using local driver and credentials file?

Is it possible to create a CIFS volume (using the local driver) by passing it a credentials file instead of specifying the username/password inline?

I am aware that other solutions exist like docker-volume-netshare but I don’t want to rely on 3rd party for this project and the Docker documentation states it supports similar commands as the Linux mount command so I’ve been trying to go down that path.

I have a /root/.cifs file.


Then I test it by mounting the share manually.

mount -t cifs \
-o credentials=/root/.cifs,vers=3.0 \
// /mnt

This works perfectly fine and I can read/write against the share. I then try to create the volume.

docker volume create \
--driver local \
--name persistent \
--opt type=cifs \
--opt device=// \
--opt o=vers=3.0,credentials=/root/.cifs

I don’t get any errors when I create the volume but if I try to mount it in a container I get: CIFS VFS: No username specified in the Docker log file.

I tried to be clever and modify the options to --opt o=vers=3.0,credentials=/root/.cifs,username=docker01 but that just results in a STATUS_LOGON_FAILURE.

Does Docker support an external credentials file? I can’t find any documentation on it and no practical examples so I’m hoping someone out there has run into this before.


Docker Version: 18.09.0-CE
API Version: 1.39
O/S: Ubuntu 16.04

I’m having similar issues except I keep getting invalid options. Except the options I’m using work perfectly for mounting the cif share locally.