Docker Community Forums

Share and learn in the Docker community.

How to access a mapped network folder or UNC path inside a Windows container


(Douglaswaights) #1

Hi,

I’m using Docker for Windows 1.12.2-rc1-beta27.1 on Windows 10 anniversary addition (latest bits at the time of writing) and trying to access UNC paths available to the host inside Server Core or Nano Server containers but not getting anywhere.

Is this even possible at the moment? If so can anyone help with getting this working?

I can mount folders from the C drive just fine in my containers using
docker run -it -v C:\somefolder:C:\availabletocontainer microsoft/nanoserver powershell

Interestingly in the Docker for Windows settings the Shared C:drive isn’t even checked on… but maybe this only needs to be done for Linux containers.

Also, if i create a mapped drive to a network machine in the host then stop and restart the docker service i don’t see this mapped drive as an option in the shared drives.

Having mapped this drive and restarted docker if i try something like the following
docker run -it -v Y:mappedfolder:C:\availabletocontainer microsoft/nanoserver powershell
this fails with invalid volume specification …bind source path doesnt exist

I’ve also tried running the docker service on the host as a my domain account rather than local system but that doesn’t seem to make any difference.

What i really want to do is something like the following
docker run -it -v \myUNCpath\somefolder:C:\available to container blah blah
or even better just have these UNC paths that are available to the host, also be available to the container somehow…

Any help would be appreciated!

Thanks
Doug


How to access a windows network share
(Michael Friis) #2

Excellent question.

  1. I don’t think UNC paths are supported by the Docker Engine
  2. I can reproduce the problem where attempting mount from a network drive doesn’t work either
  3. The Docker for Windows drive sharing settings are un-related to this. I’ve created an internal ticket so that we can make this clearer (in fact, I did my testing in a Windows Server 2016 VM)

Could I ask you to open an issue on Docker to track 1) and 2)? Or I can do it if you prefer.

If you’re up for shawing yaks to get to an interim solution, you could try to use an SMB-combatible Docker volume plugin: https://github.com/ContainX/docker-volume-netshare


(Douglaswaights) #3

Thanks for the response!

I’ve opened the issues but i cant seem to post them in this response (something to do with being a new user)

numbers are
27099
27100

Thanks
Doug


(Michael Friis) #4

More debate here: https://github.com/docker/for-win/issues/124