I'm using docker v20.10.17 in a windows system. I'd like to run a container (jupyterhub/jupyterhub) and mount a directory into it to share data (for all users with write permission inside the container system).
The shared directory is from another NAS (//192.168.1.5/folder/shared_data), which can be opened properly from the host system. I followed the Create CIFS/Samba volumes instruction here to create a samba volume first:
PS C:\Users\Administrator> docker volume create \
--driver local \
--opt type=cifs \
--opt device=//192.168.1.5/folder/shared_data \
--opt o=addr=192.168.1.5,username=myusername,password=mypassword,file_mode=0777,dir_mode=0777 \
--name cif-volume
Which successfully created a volume named cif-volume
. Then:
PS C:\Users\Administrator>docker run --rm -it -p 18000:8000 \
--name jhubcontainer \
--cap-add SYS_ADMIN \
--cap-add DAC_READ_SEARCH \
--privileged \
-v cif-volume:/etc/skel/shared_data jupyterhub-image
And I got error message like this:
docker: Error response from daemon: failed to mount local volume: mount //192.168.1.5/folder/shared_data:/var/lib/docker/volumes/cif-volume/_data, data: username=myusername,password=mypassword,file_mode=0777,dir_mode=0777: operation not supported.
See 'docker run --help'.
Need help with this.
Update 2022/11/03 with updated message:
I tried to update my command based on the help of Slava Kuravsky, but still got errors. Within the previous question, I used a pseudo address and username. I'll paste the exact command I used with the real address and username, without any modifications.
PS C:\Users\Administrator> docker volume create --driver local --opt type=cifs --opt device="//172.16.90.50/public/shared_data" --opt o=addr=172.16.90.50,username=212,password=ziyuan,file_mode=0777,dir_mode=0777,vers=2.0 --name cif-volume
cif-volume
PS C:\Users\Administrator> docker run -it --rm -p 18000:8000 --name jhubcontainer -v cif-volume:/etc/skel/shared_data jupyterhub-20221021-mountsmb
docker: Error response from daemon: failed to mount local volume: mount //172.16.90.50/public/shared_data:/var/lib/docker/volumes/cif-volume/_data, data: addr=172.16.90.50,username=212,password=ziyuan,file_mode=0777,dir_mode=0777,vers=2.0: invalid argument.
See 'docker run --help'.
PS C:\Users\Administrator>
The docker image is "jupyterhub/jupyterhub", and "jupyterhub-20221021-mountsmb" is a backup after installed some other python packages and configures.
To make sure the address is accessable, I tried:
PS C:\Users\Administrator> net use m: \\172.16.90.50\public\shared /user:212 ziyuan
命令成功完成。
The printout "命令成功完成" means "Command succeed". And I can see my mounted driver "M:" in explorer