0

I want to mount a CIFS share for my docker container to use. This already worked by explicitly creating a docker volume like so:

docker volume create --driver local --opt type=cifs --opt o=vers=2.0,username=xxxx,password=xxxx --opt device=//servername/Documents Documents
docker run -i --rm -v Documents:/mnt busybox ls -l /mnt

however I want to prevent that I have to create explicit volumes. As it has worked similarly for NFS volumes I now want to mount the volume in the docker run command directly:

docker run -i --rm --mount type=volume,volume-driver=local,dst=/mnt,volume-opt=type=cifs,volume-opt=o=vers=2.0,volume-opt=o=username=xxxx,volume-opt=device=//servername/Documents busybox ls -l /mnt

Here I am getting 'permission denied' errors, which is obvious as I have not used the password. How can I specify the password? All my attempts writing something produced different error messages.

docker run -i --rm --mount type=volume,volume-driver=local,dst=/mnt,volume-opt=type=cifs,volume-opt=o=vers=2.0,volume-opt=o=username=xxxx,password=xxxx,volume-opt=device=//servername/Documents busybox ls -l /mnt

gives me unexpected key 'password' in 'password=xxxx'

docker run -i --rm --mount type=volume,volume-driver=local,dst=/mnt,volume-opt=type=cifs,volume-opt=o=vers=2.0,volume-opt=o=username=xxxx,volume-opt=o=password=xxxx,volume-opt=device=//servername/Documents busybox ls -l /mnt

gives me password=xxxx: invalid argument.

My feeling is I need to somehow escape the comma but do not know how.

Queeg
  • 7,748
  • 1
  • 16
  • 42
  • Have you tried providing the password on the `docker run` command line? You're already passing the `username=` option. Why not try the same syntax for the `password=` option? – larsks Mar 06 '21 at 23:54
  • I edited my question. The same syntax does just give error messages, hence my question. – Queeg Mar 07 '21 at 00:07
  • Noone seems to have an answer. I raised https://github.com/docker/cli/issues/3004 – Queeg Mar 10 '21 at 22:07

0 Answers0