Docker Community Forums

Share and learn in the Docker community.

Volume mounts in windows does not work


(Stevenwillett) #142

This worked for me,

So I went to Local Security Policy > Network List Manager Policies and Double-clicked ‘unidentified Networks’ and change the location type to ‘private’. Then I restarted Docker and it worked.

been pulling my hair out with AVG firewall rules to no avail, this resolved my long pain.

Thanks @ijeweb


(Araikwar) #143

I faced the same issue and after following steps mentioned in a blog, i am able to share files/directory between windows host and docker container. Here is the link to that blog https://rominirani.com/docker-on-windows-mounting-host-directories-d96f3f056a2c


(Densom) #144

I was able to resolve my issue as follows. It turns out SMB v2 was disabled on my Windows 10 machine. Only SMB v1 was active. In the Docker log file, it was reporting “host is down” when trying to mount the share.

To check the status, I ran the following command in an elevated PowerShell prompt:
Get-SmbServerConfiguration | Select EnableSMB1Protocol, EnableSMB2Protocol

It reported that “EnableSMB2Protocol” was false.

To resolve, I ran the following command:
Set-SmbServerConfiguration -EnableSMB2Protocol $true

I was then able to check the box next to my “C” drive. It “stuck” when I applied the changes. Prior to this change, it would automatically revert to unchecked.

For more details on the PowerShell command, check out the following article:
https://support.microsoft.com/en-us/help/2696547/how-to-enable-and-disable-smbv1-smbv2-and-smbv3-in-windows-and-windows


(Mggillen) #145

This recommendation worked for me. There is a popup that docker (on Windows 10) throws up asking to share the drive so just say okay and the container will startup just fine.


(Mjmunger) #146

I had this issue while trying to share a dirctory on E:. For some reason, moving the data from E to C fixed the issue. docker run -t -i -v /c/docker/php-ant/php-7.1.9:/usr/src/php php-ant worked.


(Schroding3rscat) #147

Same problem here. I did two things, not sure what exactly helped:

  1. Changed type of Docker switch:
    Set-NetConnectionProfile -InterfaceAlias "vEthernet (DockerNAT)" -NetworkCategory Private
  2. Unchecked sharing my D: drive in the settings.

Then I run the command again and Docker asked about permissions again. I answered yes and it forced me to re-enter my domain password. After this, I was able to view contents of a mounted folder. I think, that I initially allowed sharing with another domain password (expired now) and Docker cannot handle such situations.


(Iceshaft07) #148

I had a similar issue.

It took two things to get it working:

1st) When mounting the volume on windows, you MUST begin with a /c/...
docker -v /c/users/myname/myfiles:/opt/my/dir .......

2nd) You must enter your domain password. This appeared as a ‘pop-under’, and I had to close all of my windows in order to find the domain login screen.


(Paulestan) #149

You can also try Windows Server 2016 core release 1709, which introduces global mapping of SMB drives. I’ve tried it and it works great. See: https://docs.microsoft.com/en-us/windows-server/get-started/whats-new-in-windows-server-1709


(Nlachmann) #150

Using gitbash and/or conemu in Windows environment the only way I can get a volume to show up with its contents is using the windows style drive letter, e.g:

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

The following does not work (anymore) but I think it did some time before the last release (running 17.12.0-ce here).

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

Also a single slash before the volume never worked for me.


(Sam) #151

does --mount,type=bind,source=,dest= work?


(Nlachmann) #152

Yes, both seem to do job in GitBash/ConEmu and the mounted directory list the files, as expected :

  docker run --rm --mount type=bind,source=c:/tmp,target=/data alpine ls //data/
  docker run --rm --mount type=bind,source=/c/tmp,target=/data alpine ls //data/

(Seso) #153

Just a remark: I tried using docker under cygwin. Instead of mounting a volume as in

docker run -it -v /home/blah/share:/share ...

(as on unix) I had to use

docker run -it -v 'c:/cygwin64/blah/share':/share ...

The reason is clear : “docker” is a window programm and doesn’t know about the cygwin (unix) file system.


(Sam) #154

in cygwin the path syntax to access the windows drive letters is

/cygdrive/drive_letter/path

/cygdrive/c/users/ etc


(Seso) #155

That’s true, but (at least in my case)

docker run -it -v ‘/cygdrive/c/home/blah/share’:/share …

does not work, while

docker run -it -v ‘c:/cygwin64/home/blah/share’:/share …

does.
I used this “babun” adaptor which makes the windows docker installation usable under cygwin.
There, “which docker” shows

/cygdrive/c/Program Files/Docker/Docker/Resources/bin/docker

So, the executable from the windows installation is called directly. The windows command can’t interpret a cygwin (i.e. Unix) path correctly. To use “real” cygwin paths one had to implement a script or so which transforms the unix path on the left side of “-v left_unix:right” to a windows path “-v left_windows:right” and pass it to the “real” docker command.

Maybe such a thing already exists ?

I think I will do this, do provide compatibility.


(Prabhushan) #156

if anyone using windows 7 (using docker toolbox) and facing the issue of volumes, i resolved it by add / to the C drive something like below
docker run -p 8181:80 -v /c/Users/TEST/Documents/project-test/modules:/var/www/html/modules


(Xtrazyx) #158

I resolve the problem by allowing the docker-users security group permission to access the shared directory.

1- Go to the folder you want to access
2- Properties -> Security -> Modify -> Add -> YourMachine\docker-users (you can check via the nearby button) or search with the advanced button the docker-users group

This is due to the access control by default on Windows 10, even if your are logged and your credentials are good, you are not a real administrator of the system. So i think the rights does translate to docker-users as local user which has not the permissions required.

This is not very neat but it works.


(Xtrazyx) #159

But it works just once. Then, when rebooting the issue appears again.


(Wyckster) #160

This happened to me after having changed my password on my computer.

To resolve the problem, I went to Docker for Windows (right click the whale in the notification icon area of the task bar and choose settings) Then in the left panel choose shared drives and at the bottom of the window click Reset credentials…. Make sure your shared drive is on the list and is checked, and then click Apply. You will have to re-enter your password, but then docker for windows will remember it. At this point, the docker command with syntax -v c:\hostfolder:/containerfolder should work.


(Cztomek) #161

@wyckster That’s the one in my case, thx.


(Hellosri) #162

So glad I found this thread. After banging my head for a day, I can confirm this on windows server 2016 running docker 18.03ce. Any special characters in the password for the shared volume, makes it fail, & the container cant access it.

How is this not an official bug??