Docker Community Forums

Share and learn in the Docker community.

Volume mounts in windows does not work

I found another problem, namely that “File and printer sharing” may be turned off. That causes volume mounting to silently fail for me.

It can be enabled in the GUI or with:

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
2 Likes

Thanks, interesting point, but I checked: this was correctly set on my system.

Did you try what @rneugeba suggested here? Volume mounts in windows does not work

Changed my password (ASCII, but with digits, no special characters) to very simple one, and did a reset.

Did what you suggested. Made sure that it returns:

nsfs on /run/docker/netns/0092889bbf49 type nsfs (rw)

and otherwise everything what @rneugeba got as a response

Tried

docker run --rm -v c:/:/data alpine ls -R /data/
/data/:

Tried:
docker run -d -v c:/tmp/Gastrobase:/home/shiny/Gastrobase --name=gastro-docker dmenne/gastro-docker

which runs Ok under VM/Windows 7 on another computer. All network/shiny functions relying on file in the container run Ok. No sharing.

Returns on inspect:

"Mounts": [                                        
    {                                              
        "Source": "/c/tmp/Gastrobase",             
        "Destination": "/home/shiny/Gastrobase",   
        "Mode": "",                                
        "RW": true,                                
        "Propagation": "rprivate"                  
    }                                              
],                                                 

But nothing is there: From bash in the above

> root@04da158c6350:/# ls home/shiny/Gastrobase
(nothing)

Tested with Beta 13 (but probably no change compared to 12, I just wanted to create a simplified example to illustrate topic 33 in this thread. Printer sharing on, ASCII password, C is mapped.

Unmodified transcript after a restart of Docker. A directory C:\tmp exists and has files in it. Note that the third command is the same as the first, but returns something different.

>docker run --rm -v c:/:/data alpine ls -R /data/     
/data/:                                               
                                                      
>docker run --rm -v c:/tmp:/data alpine ls -R /data/  
/data/:                                               
                                                      
>docker run --rm -v c:/:/data alpine ls -R /data/     
/data/:                                               
tmp                                                   
                                                      
/data/tmp:

Thanks for your immense patience. Here’s another thing to try:

You can get almost root in the Linux VM like this (from here):

#get a privileged container with access to Docker daemon
docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh

 #run a container with full root access to MobyLinuxVM and no seccomp profile (so you can mount stuff)
docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh

 #switch to host FS
chroot /host

… and then trying the mount manually:

mount -t cifs //10.0.75.1/C /C -o username=<username>,password=<password>,noperm

10.0.75.1 is the IP that the Linux guest can see your host at.

Sorry for the insistence… The forum software already complained that I talk too much ._)

docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
— I do not fully understand this command, so I could not correct it, but it gives an error:

docker: Error response from daemon: Unable to setup mount point, neither source nor volume defined.

I had already tried another version from Vietnam which partly worked:

docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh

And I am in some # bash
(I will try to modify it to your version)

Dieter,
After running:

  1. docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh
    and inside the created shell, you run the 2nd command:
  2. docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
    and finally inside the shell created in 2), you run:
  3. chroot /host
    followed by the mount command mentioned before by Michael.

Curious about the root of the problem…

Thanks, po, I had read and tried your other post on the subject, but in error thought that the second command had to be given NOT inside the created shell. Some progress here: c and C are there. To be sure: ping to 10.0.75.1 works.

docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh
 / # docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh
 / # ls
 bin      dev      etc      home     host     lib      linuxrc  media    mnt      proc     root     run      sbin     sys      tmp      usr      var
 / # chroot /host
 / # ls
  C         Mac       c         etc       init      linuxrc   port      root      sbin      tmp       var
     Database  bin       dev       home      lib       media     proc      run       sys       usr
     / # ls c
     / # ls C
     / # mount -t cifs //10.0.75.1/C /C -o username=Dieter,password=mydearpass,noperm
     mount error(115): Operation in progress
     Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
     / #

Oh the dreaded 115 return code. Assuming that the root shares are operational and username=Dieter has access to those shares (pls confirm) here is my suggestion (Michael knows better…):

umount all the shares (/c /C /d /D)
cat /proc/fs/cifs/DebugData (post here pls)
echo 7 > /proc/fs/cifs/cifsFYI
mount -t cifs //10.0.75.1/c /c -o user=Dieter,password=yourpassws,domain=yourhostname
cat /proc/fs/cifs/DebugData (post here pls)
dmesg (last 20 lines or so…)
echo 0 > /proc/fs/cifs/cifsFYI just to undo previous

Last messages of dmesg will detail cifs errors…

Also interesting to confirm whether the c-drive is browsable using File Explorer on the host at \\10.0.75.1\c

I tried to follow along as I am having similar problems with mounts in Docker Beta windows. I got a different error after the final mount:
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

This was with a new user and a simple alpha-only password, and a restart, unshare, reshare. Trying to browse the c-drive gives me ‘Windows can’t find ‘\10.0.0.75.1\c’. Check the spelling and try again.’

In case somebody wants to try: It probably should be:

10.0.75.1/C

(or lowercase c)

Please correct me if I misunderstood.

Gives 404 on http://10.0.75.1:80/C.

C was shared. Same for unshared drives, e.g. D

Thanks for you patience. I hope by “unmount all the shares” you mean: Unshare all in Docker settings. If not, please correct me. As an alternative, I tried it within bash when C had been shared:

/ # umount c            
umount: c: not mounted  
/ # umount C            
umount: C: not mounted  

Password: the password is my only password on this computer. This is a development computer, I have all rights as administrator. No domain. When I enter the wrong password during sharing in Docker Settings, system complains.

Your requests:

>docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh
/ # docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh

/ # ls
bin      dev      etc      home     host     lib      linuxrc  media    mnt      proc     root     run      sbin     sys      tmp      usr      var

/ # cat /proc/fs/cifs/DebugData
Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.08
Features: dfs fscache posix xattr
Active VFS Requests: 0
Servers:

/ # echo 7 > /proc/fs/cifs/cifsFYI
/ # mount -t cifs //10.0.75.1/c /c -o user=Dieter,password=mydearpassword,domain=yourhostname
mount: mounting //10.0.75.1/c on /c failed: No such file or directory
/ # cat /proc/fs/cifs/DebugData
Display Internal CIFS Data Structures for Debugging
---------------------------------------------------
CIFS Version 2.08
Features: dfs fscache posix xattr
Active VFS Requests: 0
Servers:
/ # dmesg
...
...
hv_balloon: Data Size is 8
random: nonblocking pool is initialized
nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.
aufs au_opts_verify:1597:docker[1339]: dirperm1 breaks the protection by the permission bits on the lower branch
device veth33f503a entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): veth33f503a: link is not ready
docker0: port 1(veth33f503a) entered forwarding state
docker0: port 1(veth33f503a) entered forwarding state
docker0: port 1(veth33f503a) entered disabled state
IPVS: Creating netns size=1328 id=3
cgroup: docker-runc (3320) created nested cgroup for controller "memory" which has incomplete hierarchy support. Nested cgroups may change behavior in the future.
cgroup: "memory" requires setting use_hierarchy to 1 on the root
eth0: renamed from veth75807f3
IPv6: ADDRCONF(NETDEV_CHANGE): veth33f503a: link becomes ready
docker0: port 1(veth33f503a) entered forwarding state
docker0: port 1(veth33f503a) entered forwarding state
IPv6: ADDRCONF(NETDEV_CHANGE): docker0: link becomes ready
docker0: port 1(veth33f503a) entered forwarding state
/ #

Dieter, tough nut to crack. It looks like the sharing is not setup under windows. The culprit show up in:
mounting //10.0.75.1/c on /c failed: No such file or directory

  1. ensure shares are available. On a Windows command prompt

    C:\Users\po755>net share
    Share name Resource Remark

    C C:\ Caching disabled
    D D:\ Caching disabled
    E E:\ Caching disabled
    The command completed successfully.

  2. ensure you have access to those shares under your Dieter userid. That is
    net use \\<computername>\C
    must work under your userid. And use the computername instead of domain name in the cifs mount command.

Thanks, Manuel.

>net share

Name         Ressource                       Beschreibung
-------------------------------------------------------------------------------
....
C            C:\                             Zwischenspeicherung deaktiviert (Caching disabled)
D            D:\                             Zwischenspeicherung deaktiviert
E            E:\                             Zwischenspeicherung deaktiviert
...
Der Befehl wurde erfolgreich ausgeführt.  (successfully)

... Name of computer is DieterPC ...
 
>net use \\DieterPC\C
Der Befehl wurde erfolgreich ausgeführt. (success)

Wow, closer to target thanks to your help. Not that I understand why this works. After all, my computer knows what 10.0.75.1 is.

/ # mount -t cifs //DieterPC/C /C -o username=Dieter,password=mypassword,noperm                                                                                                                      
/ # ls                                                                                                                                                                                           
C         Database  Mac       bin       c         dev       etc       home      init      lib       linuxrc   media     port      proc      root      run       sbin      sys       tmp       usr
      var                                                                                                                                                                                        
                                                                            
/ # ls C                                                                                                                                                                                         
$Recycle.Bin                 Documents and Settings       Program Files (x86)          Recovery                     Windows                      inetpub                                         
BOOTNXT                      Dokumente und Einstellungen  ProgramData                  Rtools                       autoexec.bat                 pagefile.sys                                    
BOOTSECT.BAK                 IO.SYS                       

(Rest removed, but looking fine)

Glad to hear that’s working now… your turn to let us know what did you do to make it to work… :slight_smile: One thing I noticed: you’re mounting the share using the computer name instead of the IP address…

Mounting the share using the computer name instead of the IP address: I read this from your comment: “And use the computername instead of domain name in the cifs mount command”. The blame goes to you :slight_smile:

However, I do not think that this is a solution, just a way of getting it to work in my setting. After all, this should work without four rather nasty lines on the command prompt (five, one more for c/C). I hope that it will help the developers to get this done automatically. I use docker to supply ready-to-use installation of R and Shiny to my colleagues at the hospitals, and even one line in the black box will lead to immediate “not for us” reactions.

docker run --privileged -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker alpine sh
# inside the created shell, you run the 2nd command:
docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine /bin/sh 
mount -t cifs //<computername>/C /C -o username=Dieter,password=yourpassword,noperm

Note: computername is the Network name of the computer.

2 Likes

I tried the solution from @elucas and it works for me.

1/ to be sure, change your windows password with something simple with no special chars
2/ reset your shared drive credentiel, and don’t mount C:
3/ when you are prompt for login / password use :
10.0.75.1\yourusername (or 10.0.75.1\yourusername@something.com if necessary)
and your password
4/ try with the docker example : docker run --rm -v ./folderwithfiles:/data alpine ls /data

It worked for me on 2 different PCs

1 Like