Volume mounts in windows does not work

I run it in Windows using Cygwin.

thanks, funny I am using docker precisely so I dont have to install Cygwin :slight_smile:

Hereā€™s a raw equivalent in PowerShell:

$drive = $env:homedrive.Substring(0,1)

$ip = Get-NetIPConfiguration -InterfaceAlias "vEthernet (DockerNAT)" | Select IPv4Address
$unc = "//" + $ip.IPv4Address.IPAddress + "/" + $drive

[Environment]::SetEnvironmentVariable("UNC", $unc, "Process")
[Environment]::SetEnvironmentVariable("DRIVE", $drive, "Process")
docker run -ti --rm --privileged --pid=host -e USERNAME -e USERDOMAIN -e DRIVE -e UNC ubuntu nsenter --target 1 --mount --uts --ipc --net --pid sh -x -c '
  [ -d "/${DRIVE}" ] || mkdir "/${DRIVE}" && \
  mount.cifs "${UNC}" "/${DRIVE}" \
    -o "user=${USERNAME},domain=${USERDOMAIN},noperm,forceuid,mfsymlinks,file_mode=0700,dir_mode=0700,nobrl,vers=3.0"
'
1 Like

thanks for that conversion. unfortunately back to volumes not working on windows with very little idea why, I get 115 operation pending error when I manually try the mount. I am on the pre-release windows program and it is a bit of a crap shoot when a new windows build comes along whether docker mounts will work.

Running Win10 Pro (build 1607)
Docker version 1.12.1

Unfortunately, still experience the same issue. Tried all solutions above multiple times. Additionally tried to install beta version of Docker for Windows with no success. Here are my observations:

  1. When I follow this approach I can get host folder mounted properly and sharing seems to work. However, I have no clue what do I supposed to do next. This workaround seems to be temporary and sharing drops as soon as I quit the container.
  2. User name & password contain only [a-zA-Z] chars
  3. \\10.0.75.1\C shows the list of files properly
  4. Shared Drives in Docker app configured properly (tried all combinations of username with ip/machine names mentioned in the topic)
  5. Firewall & Antivirus are disabled
  6. This PS script throws mount error(112): Host is down. But itā€™s certainly up.
  7. Played with shared folders through Kitematic, the sharing didnā€™t work either.
  8. Unidentified networks resolve as private
  9. The file log contains:

[SambaShare ][Info ] ā€œCā€ is shared
[SambaShare ][Info ] Challenging credentials with host
[SambaShare ][Info ] Challenging credentials with host succeeded
[NamedPipeServer][Info ] TryShare done.
[NamedPipeClient][Info ] Received response for TryShare
[NamedPipeClient][Info ] Sending Mount(C, Spleshka:)ā€¦
[NamedPipeServer][Info ] Mount(C, Spleshka:
)
[HyperV ][Info ] Mount C
[NamedPipeClient][Info ] Received response for Mount
[NamedPipeClient][Info ] Sending Unmount(D)ā€¦
[NamedPipeServer][Info ] Mount done.
[NamedPipeServer][Info ] Unmount(D)
[HyperV ][Info ] Unmount D
[NamedPipeClient][Info ] Received response for Unmount
[NamedPipeServer][Info ] Unmount done.
[ApiProxy ][Info ] proxy >> POST /v1.24/containers/create [rewriteBinds]
[ApiProxy ][Info ] Rewrote mount c:/Users:/data (volumeDriver=) to /c/Users:/data
[ApiProxy ][Info ] Failed to Walk to [snapshots 1407707c5776aafac0c5278b2623c29b845ab6c7 ro com.docker.driver.amd64-linux proxy http] 9p: No such file or directory

Any ideas guys what I could have missed? Will appreciate any help, nearly give up trying.

I am able to easily mount volumes when running a container:
docker run -v c:/src:/src imageName:tag

However I am unable to mount a windows volume from a docker file or a docker compose yml file when trying to build a image.

VOLUME c:/src:/src

What I am trying to do is to build dotnet core applications from a container rather than build that application on the host and copying the binaries into the container that runs.

I finally solved it! just add / before c as:

-v ā€œ/c:/Users/samir/Documents/Workspaceā€:/usr/src/lambda

or, even better:

-v /$(ā€œpwdā€):/usr/src/lambda

1 Like

After following this thread for a few weeks now and trying (almost) everything, I finally got it working.

I enabled NFS-Services in the ā€˜Install optional featuresā€™-popup and now everything works as expected! Just wanted to leave this here as a hint for anybody who followed this thread and didnā€™t have any success so farā€¦

Mounts didnā€™t work for me on a latest stable version. But it seems to be fixed in latest beta. Try it out.

  • In Windows, make sure you have enabled sharing options and docker share drives options.
    enabled-sharing.png

detail and some example here: https://hub.docker.com/r/lynam/meteor/
( i only can post 1 image here, so see my docker repository for full tutorial )

If youā€™re on Win7 with Git Bash use

docker run -v ///c/Users/your.user/folder:/mnt/point ā€¦

Suggestion is from https://github.com/docker/docker/issues/12590#issuecomment-96767796
Works with:

Server Version: 1.12.2
ā€¦
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.24-boot2docker
Operating System: Boot2Docker 1.12.2 (TCL 7.2); HEAD : 9d8e41b - Tue Oct 11 23:40:08 UTC 2016

1 Like

On Docker 1.12.1-stable this worked for me, Thanks!! Still strange to me is that I tried all these steps with my original user and it would not work, while creating a new user with the same permissions does. Very confusing

Thank you @ruloweb. Either the advanced Sharing settings or the advance Security setting made it work in my case.

PS C:\WINDOWS\system32> docker run --privileged=true -it -v C:/ftp:/ftp_data gcr.io/tensorflow/tensorflow:latest-devel
root@e0cf73e74561:~# ls /ftp_data/
High-Speed Tracking with KCF.pdf
Multi-Template Scale-Adaptive Kernelized Correlation Filters.pdf
THESIS_source_controlled

Inside docker-compose.yml and inside the container it works like this

No this is mounting the volume at run time. I want to mount a volume at build time, when creating an image.

This worked for me, thanks!

Iā€™ve been trying to get shared volume mounts with my set up working for a couple of days now! Your comment solved my problem for me.

Set up:

  • Docker Client: WSL a.k.a. Bash on Ubuntu on Windows
  • Docker Engine: Docker for Windows (Hyper-V)
  • Code location: Windows drive (so WSL path started /mnt/c/Users/hello/ etcā€¦)

My docker compose file was using a relative path from my code directory. The container booted up fine but there were no files where the shared volume should be. The odd thing was that creating a file inside the shared directory persisted after destroying the container. This meant that the directory was being pointed somewhere, just that I couldnā€™t find it. docker inspect returned the correct absolute path to the folder. Lost, I gave up.

So today, suspecting the problem was with Docker for Windows (Hyper-V), tried installing Docker Toolbox (Boot2Docker running inside VirtualBox). This came with Kitematic, a GUI for docker containers I didnā€™t know existed. After a bit of messing around with adding the Boot2Docker client certificate to the WSL environment (env vars didnā€™t get set), I ran docker-compose up again. The containers appeared in the VM instance, but I had the same problems as before - no files in the shared volume.

Frustrated I decided to waste some time seeing what Kitematic could doā€¦

Clicking around the UI I found the ā€œVolumesā€ tab of the settings page. Lo and beholdā€¦

The absolute path created by docker compose inside WSL, /mnt/c/Users/hello/code/..., is mapped to \mntC:\Users\hello\code\.... Itā€™s just some weird path mangling problem! So it turns out paths starting /// are both recognised by Windows and are not mangled by docker compose or WSL. So now my docker compose file uses ///c/Users/hello/code/.... This gets translated into ```C:\Users\hello\codeā€¦" which is a valid Windows path, and now my shared volumes work.

Iā€™ve skimmed this thread several times over the last couple days and chanced across your comment today @inge4pres! So thanks go to you. And I guess Docker for including a UI for Windows which shows the paths that shared volumes actually resolve to. We are now going to use an environment variable in the docker compose file so builds on Ubuntu can use the relative path, and I can use a mangled WSL path instead.

1 Like

I am using Docker version 1.13.0, build 49bf474 on win 10 and solved my problem changing the password because the old pass contains caracters especials , and sharing the volumes

ex: docker run -p 5984:5984 -P --name web -v /data:/usr/local/var/lib/couchdb couchdb

thanks for this forum :slight_smile:

1 Like

worked for me too. thanks

1 Like

I had the same problem, but I was not as familiar with Norton Firewall as donurk. I asked for help on Norton Chat, and Purvi Vijayvargia was very helpful. She reset the firewall rule to allow Docker to participate in drive sharing and the problem was corrected. The issue is definitely that Norton wonā€™t allow file sharing by Docker, but this is a correctable problem. High marks to Norton help.