Docker bind mount gvfs location

Hello

In my current scenario I add network drives to a machine with the package gvfs (gio mount smb:/IP/public). Currently, these are only samba shares, but should remain open. After a successful mount the data on the network drive is available via the path /run/user//gvfs/smb-share:server=IP,share=public/.

I want to add such a directory to a container using bind mount. Concerning the special characters in the gvfs link I found the post (https://github.com/docker/cli/issues/1480) which concerns exactly my problem. However, it seems that this is no longer possible and I have no success adding such a link to a container. The following error message is displayed:

docker: Error response from daemon: invalid mount config for type "bind": stat /run/user/<id>/gvfs/smb-share:server=<IP>,share=public: permission denied.

Second Try:

As a second solution I tried to add the network drives to the container with docker volumes (example: https://nerdblog.steinkopf.net/2017/12/persistente-docker-volumes-mit-nfs-und-cifs/).

docker volume create --driver local --opt type=cifs --opt device=//<IP>/public --opt o=username=username,password=passwort ShareVolume

This seems to work, but the password is displayed in clear text in a docker volume inspect. Is there any way to prevent this from being displayed?

Thanks for any help,
-ralphhso

here are some version information about the os and docker

 $ hostnamectl
 Static hostname: bwlp-client-test
 Icon name: computer-desktop
 Chassis: desktop
 Machine ID: c73680c569f1477c8b9f9e9bf3c60b39
 Boot ID: 91a1f36714664244baf3985f7e4994e1
 Operating System: Ubuntu 18.04.4 LTS
 Kernel: Linux 4.19.142-openslx+
 Architecture: x86-64

Client: Docker Engine - Community
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        48a66213fe
 Built:             Mon Jun 22 15:45:36 2020
 OS/Arch:           linux/amd64
 Experimental:      false

$ docker version
Server: Docker Engine - Community
 Engine:
  Version:          19.03.12
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       48a66213fe
  Built:            Mon Jun 22 15:44:07 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

I got a hint from a colleague, that the root user has no access to the users mounted network share. I had to start the gvfsd-fuse process with the right option to allow that. Here is the Instruction I used.

After that modification I could bind mount the gio mount point directories into a container.

docker run -it --rm \
    --mount  type=bind,\"source=/run/user/ID/gvfs/smb-share:server=IP,share=public/\",target=/data/public \
    python 

huge thanks for updating and for sharing this. i really found it useful too for my project.
may i ask any other questions if anything? thanks again

I am glad that my post could help!

In case of further questions, I will try to help but with no promise

-ralphhso

of course! asking for my project: https://hilmabiocare.to/ my first general question would be: how did you learned it? have you done it all yourself or with some help?