Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume mounts do not work on windows 10 #77

Closed
ghost opened this issue Sep 13, 2016 · 66 comments
Closed

Volume mounts do not work on windows 10 #77

ghost opened this issue Sep 13, 2016 · 66 comments

Comments

@ghost
Copy link

ghost commented Sep 13, 2016

Expected behavior

docker run -it -v //c/Users://c/users Ubuntu bash
ls -al /c/users should show windows usernames

Actual behavior

Volume is created but /c/users is empty

Information

I have read all the issues where this has been reported before. Nothing I have tried makes any difference. It doesn't work. Even though volume is created in the container, it does not show any directories and files from the source path. Neither Issue #25 or Issue #50 solve this problem.

  1. Have disabled the firewall.
  2. Shared c in docker settings. have reset and supplied credentials.
  3. Have tried all variations of command syntax for volume parameter
  4. No help from freenode docker channel.
  5. Java client api using mounts works fine if Linux -> Linux. Same code fails with windows.
  6. When I inspect container it contains the proper source location.
  7. Fails the same whether run under powershell or cmd.
    • Diagnostic ID from "Diagnose & Feedback" in the menu.
    • a reproducible case if this is a bug, Dockerfiles FTW
    • page URL if this is a docs issue or the name of a man page
    • host distribution and version (Windows version, build number, etc)

A86A3BDC-3635-4682-A3B1-467D8ABE2260/2016-09-13_09-56-40

Steps to reproduce the behavior

  1. ... docker run -it -v //c/Users:/users Ubuntu bash
  2. ...ls -al /users
    Volume is mounted but nothing in the directory.
@ghost
Copy link
Author

ghost commented Sep 13, 2016

snap1

@MadLittleMods
Copy link

MadLittleMods commented Sep 14, 2016

@billhab I think you are experiencing Hyper-V driver not supporting mounting volumes, see moby/moby#22981

I don't think the hyper-v driver does host (win) to guest (boot2docker) filesharing, so volume-mounting from the host windows 10 filesystem is not expected to work.

moby/moby#22981 (comment)

Ah! Yes, the Hyper-V machines don't have this as an option, only VirtualBox (and Docker for Windows)

moby/moby#22981 (comment)

You might be interested in this comment:

We have this problem with the docker beta on Windows. -v //Users/project://project doesn't work. There is no error message but nothing is mounted under /project inside the container. But we can do docker create -v //Users/project://project --name project-volume and then docker run --volumes-from project-volume

moby/moby#21909 (comment)

@ghost
Copy link
Author

ghost commented Sep 14, 2016

I think this is going in the direction that I will not be able to mount volumes successfully in a Windows environment. What good is docker if I can't access my data? I have read so many comments the past couple days that make my head spin. Do this: turn off your firewall or change firewall rules, play with domain user name, remove passwords with funny characters, reset credentials/restart Docker. Is there ANYTHING which works here? Would going to virtual box solve the problem? Maybe not because some people report that doesn't work either. Excuse me but I'm really frustrated with this scenario and no reliable answers.

@friism
Copy link

friism commented Sep 14, 2016

@MadLittleMods that's not the case - Docker for Windows supports volume mounting.

@billhab can you try the test command suggested in the app?

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

@ghost
Copy link
Author

ghost commented Sep 14, 2016

@MadLittleMods - If you look at the screen shot which is the above you'll see I have done that. In fact I have done it about a hundred times when trying different combinations of suggestions from various people. It simply doesn't work. Now I heard that using hyper-v with Docker which is my setup does not support mounting volumes.
Is my only recourse to uninstall docker and reinstall with virtualbox???

@MadLittleMods
Copy link

MadLittleMods commented Sep 14, 2016

@friism What are the intricacies/caveats of it? Here is a quote I found from you:

I don't think volumes are expected to work with the hyper-v driver. You should use the (default) virtualbox driver.

moby/moby#21909 (comment)


Trying not to butt into this issue but here is an example of volume mounting not working:

// Trying any of these combos
SET WORKSPACE=.
for /f "delims=" %a in ('pwd') do @set WORKSPACE=%a
for /f "delims=" %a in ('cd') do @set WORKSPACE=%a

docker-compose.yml

mongosetup:
  image: mongo:3.2
  volumes:
   - ${WORKSPACE}:/src
  working_dir: /src
  entrypoint: [ "/src/mongo-setup.sh" ]

But the entrypoint can't be found

> docker-compose up -d --no-recreate
ERROR: for mongosetup  Cannot start service mongosetup: oci runtime error: exec: "/src/mongo-setup.sh": stat /src/mongo-setup.sh: no such file or directory
> docker inspect mongosetup_1
...
"Mounts": [
            {
                "Source": "/c/Users/MLM/Documents/GitHub/something",
                "Destination": "/src",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
...

@friism
Copy link

friism commented Sep 14, 2016

@MadLittleMods that comment was talking about something created with docker-machine create using the hyper-v driver. Volume mounting from host won't work with that.

This question is about Docker for Windows, which has host volume mounting support and is different than docker machine.

@ghost
Copy link
Author

ghost commented Sep 14, 2016

I'm sorry guys. this isn't helping me. I just want to have access to a windows set of files (about 40gb of data) in a directory tree from a docker container. Mounting the path as a volume doesn't work. I'd like to find out how to make it work. If there isn't a way to get it working then I'd like to know so I can move on to finding another solution.

@phinz
Copy link

phinz commented Sep 14, 2016

i have the same issue. The example command has a empty result:

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

Until i tried to mount a subfolder:

> docker run --rm -v c:/Users/phinz:/data alpine ls /data
>
> docker run --rm -v c:/Users:/data alpine ls /data
> phinz

That seems very strange, because there are still more user folders in the path "c:/Users".

> ls c:/Users
drwxr-xr-x 1 phinz 1049089   0 Jan  4  2016 ./
drwxr-xr-x 1 phinz 1049089   0 Sep  8 09:24 ../
lrwxrwxrwx 1 phinz 1049089  14 Okt 30  2015 All Users -> c:/ProgramData/
drwxr-xr-x 1 phinz 1049089   0 Jan  4  2016 Default/
lrwxrwxrwx 1 phinz 1049089  16 Okt 30  2015 Default User -> c:/Users/Default/
drwxr-xr-x 1 phinz 1049089   0 Sep 13 17:43 phinz/
drwxr-xr-x 1 phinz 1049089   0 Jan  4  2016 Public/
> docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 17:32:24 2016
 OS/Arch:      windows/amd64
 Experimental: true

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 17:32:24 2016
 OS/Arch:      linux/amd64
 Experimental: true

OS: Windows 10 Enterprise

UPDATE: Problem seems solved in new Beta Version 1.12.1-beta26, Build 7018

@marc1404
Copy link

marc1404 commented Sep 14, 2016

Experiencing the same problems as @phinz
Windows 10 Pro, Version 1511
Docker for Windows, Version 1.12.0-stable, Build 5968

Update: Working in beta channel, Version 1.12.1-beta25, Build 6833

@ghost
Copy link
Author

ghost commented Sep 14, 2016

Not only do you not see the content of the volume but you can't write back into it. The source never sees what has been copied there. This may be related or a different issue.

PS C:\Users\bihaber> docker run -it -v //d/scratch:/scratch bills:1.2 bash
root@b73c99d9b2c5:/# ls scratch
root@b73c99d9b2c5:/# ls -al scratch
total 4
drwxr-xr-x 2 root root 40 Sep 13 21:27 .
drwxr-xr-x 210 root root 4096 Sep 14 13:42 ..
root@b73c99d9b2c5:/# cp /bin/runtests.sh /scratch/runtests.sh
root@b73c99d9b2c5:/# ls -al scratch
total 16
drwxr-xr-x 2 root root 60 Sep 14 13:43 .
drwxr-xr-x 210 root root 4096 Sep 14 13:42 ..
-rwxr-xr-x 1 root root 9143 Sep 14 13:43 runtests.sh
root@b73c99d9b2c5:/#

@dgageot
Copy link
Member

dgageot commented Sep 16, 2016

@billhab Have you tried version Beta26? Both @marc1404 and @phinz report that it fixes their issue

@ghost
Copy link
Author

ghost commented Sep 16, 2016

Is it newer than what I am running and if so how do I get it?
PS C:\Users\bihaber> docker version
Client:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:15:28 2016
OS/Arch: windows/amd64

Server:
Version: 1.12.0
API version: 1.24
Go version: go1.6.3
Git commit: 8eab29e
Built: Thu Jul 28 21:15:28 2016
OS/Arch: linux/amd64
PS C:\Users\bihaber>

@thasmo
Copy link

thasmo commented Sep 16, 2016

@dgageot I'm running Docker for Windows version 1.12.1-beta26 and Docker doesn't mount the specified directory. Running docker run --rm -v c:/Users:/data alpine ls -al /data lists an empty directory, although I've enabled to share C: in the Docker UI settings.

@ghost
Copy link
Author

ghost commented Sep 16, 2016

I just tried Docker for Windows version 1.12.1.beta26 and it doesn't work either.
Can I get this to work if I use Docker Toolbox instead??

@ghost
Copy link
Author

ghost commented Sep 16, 2016

I have uninstalled Docker, then installed Docker toolbox. Neither work.
I reinstalled 1.12.0 stable then got notice of new stable version.
I installed stable version but installer told me it didn't have privileges to install new services.
I'm done playing games here.

@thasmo
Copy link

thasmo commented Sep 16, 2016

So, after trying over a dozen tweaks, settings, changes and reboots it suddenly works but I'm not able to break it on purpose so I've no idea what did it. :(

@protubero
Copy link

I'm trying to Mount host volumes for some weeks now, without success. Log files tell me, that sharing works, but the Directory Content shown only lists previously mounted Folders and nothing else. I'm Kind of frustrated with this.

D9E7060A-B59A-4546-BAB8-3E537A4C22D6/2016-09-19_10-04-47

@josemanners
Copy link

I followed the instructions in this article https://blogs.msdn.microsoft.com/stevelasker/2016/06/14/configuring-docker-for-windows-volumes/

and after a few tries the way I made it work was by giving Docker the local computer name as part of the credential (i.e. MYCOMPUTER\DockerHost )

@ghost
Copy link
Author

ghost commented Sep 20, 2016

josemanners - is your system windows 10 with hyper-v?

@dgageot
Copy link
Member

dgageot commented Sep 21, 2016

@billhab @thasmo @protubero @josemanners Stay tuned and thank your for being really patient. A better file sharing should ship in next beta!

@josemanners
Copy link

@billhab to answer your question, I'm running Windows 10 Enterprise Build 14393.105

@moler
Copy link

moler commented Sep 22, 2016

I had the similar issue with Docker 1.12.0-stable (Hyper-V) on Windows 10. I thing that the main problem was with my firewall which blocked Hyper-V Virtual Ethernet Adapter (DockerNAT). I did follow:

  1. Updated to new stable version 1.12.1
  2. Shared c in Docker settings and restarted Docker via Setting-Reset-Restart Docker
  3. Turned off antivirus software including firewall
  4. Restarted Docker via Setting-Reset-Restart Docker

You can try it.

@ghost
Copy link
Author

ghost commented Sep 22, 2016

@moler All that was tried. Didn't work. I have McAfee firewall. Turning it off didn't help.

@ghost
Copy link
Author

ghost commented Sep 22, 2016

@dgageot What makes you believe that the next beta will fix this issue?

@dgageot
Copy link
Member

dgageot commented Sep 28, 2016

@billhab Beta27 was released today with hardened file sharing feature. Could you take a look and close this issue if it is fixed? Thanks a lot!

@akhchan
Copy link

akhchan commented Feb 28, 2018

Works great with richarddowner's solutiion. Thanks.

@Puetz
Copy link

Puetz commented May 15, 2018

I just wanted to mount a local folder to my container and used the exact same commands that worked multiple times in the past

docker run -d --name core --mount type=bind,source="C:\Users\...\myapp",target=/app python
docker run -d --name core -v C:/Users/.../myapp:/app python

but non of them worked.
I also used
docker commit <container_id> my-broken-container && docker run -it my-broken-container /bin/bash
in order to take a look into the app folder and it was empty.

I reset my credentials, changed my password and even reinstalled Docker but it's still not working. Does anybody have an idea how I can fix this?
Thanks.

@sharkvan
Copy link

Just and FYI,

I was running into this issue where the folder mounting was not working. I was trying to run docker via the terminal Cmder. Cmder was doing something that was making the mount operation fail. So if you're reading this and using Cmder, switch to powershell on Windows.

On a side note, I was docker a lot on linux, I can't believe how slow it is on Windows, PAINFUL.

@liesislukas
Copy link

I think it was related to password change on windows user. I used @richarddowner solution to fix.

@Noext
Copy link

Noext commented Sep 5, 2018

@liesislukas is right, i have change my windows password and disk sharing was **** up after that, need to unshare and share all driver after that

@navarq
Copy link

navarq commented Nov 5, 2018

Resetting credentials via the tray icon, in settings, shared drive

Then specifying the full location of the directory to be mounted solved the issue for me.

@LeonardAB
Copy link

experienced same condition as @liesislukas and @Noext , I have to change password regularly and did not realize that it affected the docker drive sharing credential. @richarddowner solution worked like a charm. Thanks a lot!!!

It might be good if when the mounting fails, docker can give an error message.

@higkoo
Copy link

higkoo commented Dec 5, 2018

#77 (comment)

error is still exist.

docker version
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:47:51 2018
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:55:00 2018
OS/Arch: linux/amd64
Experimental: false

[16:13:26.271][SambaShare ][Error ] Unable to mount C drive: 10.22.33.1 (10.22.33.1:445) open
rm: cannot remove '/c': No such file or directory
rm: cannot remove '/C': No such file or directory
umount: /host_mnt/c: not mounted.
mount.cifs kernel mount options:
ip=10.22.33.1,unc=\10.22.33.1\C,noperm,iocharset=utf8,dir_mode=0777,nobrl,mfsymlinks,vers=3.02,sec=ntlmsspi,user=higkoo,domain=BILIOPS,pass=********
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

@alitarraf
Copy link

For those using docker toolbox, what worked for me is adding shared drive in the virtual box machine. See this link for details. I had the same issue on Windows 10 Home edition, where running docker run --rm -v //c/:/data ls /data/ was not displaying the content of my C drive. Hope helps.

@alanamircruz
Copy link

alanamircruz commented Mar 20, 2019

I tried several things to try to make run this stuff on my Windows 10 Laptop. All configurations are set (I am truly sure I did them all), so anyone can please have a clue on this by this open thread on Windows + docker + Hyper-V in 2019 ?

I do see my shared directories, but no heck sign of my files there...

c:\test>docker run --rm -v //c/:/data alpine ls -ltRr /data/
/data/:
total 0
drwxr-xr-x 2 root root 40 Mar 20 17:16 Users
drwxr-xr-x 2 root root 40 Mar 20 17:30 test
/data/Users:
total 0
/data/test:
total 0

Be or not to be docker on Windows . . .

@ihopit
Copy link

ihopit commented Apr 16, 2019

I had a few issues with docker on my windows machine:

  • since windows switched from password to pin on my computer - the shared drives still showed to be ok under docker-settings/shared drives, but actually were not working correctly any more. They had to be mounted again

  • firewalls (windows & in my case Kaspersky) blocked

  • on the drive, you want to share, the privileges have to be set correctly

@SCWTechJB
Copy link

For those using docker toolbox, what worked for me is adding shared drive in the virtual box machine. See this link for details. I had the same issue on Windows 10 Home edition, where running docker run --rm -v //c/:/data ls /data/ was not displaying the content of my C drive. Hope helps.

THANK YOU. I can see my files after mounting both ways now with Docker ToolBox

@JozefResetar
Copy link

JozefResetar commented Jun 13, 2019

What helped me was reseting credentials in Docker Desktop->Settings->Shared Drives.

@devhandle
Copy link

@dodoslav's solution worked for me.

@smarwei
Copy link

smarwei commented Sep 10, 2019

@dodoslav worked for me as well.

@Nassh04
Copy link

Nassh04 commented Sep 18, 2019

If you are still facing the issue, try the same set of commands to mount the drives using Powershell CLI and it'll prompt you to allow shared drives post which you'll be able to mount drives to containers with ease.

@jojurajan
Copy link

jojurajan commented Nov 6, 2019

Adding on to the thread. I was facing an intermittent issue with the mounted directory. The files were shared to Docker and it was working fine until the docker service got stuck for some reason. After that, if I ran the container command again, it showed an empty directory. Restarting docker did not work, but restarting the system did the trick.

Docker version: Docker version 19.03.4, build 9013bf5
OS: Windows 10
Terminal: Powershell

@kingdavid72
Copy link

Encountered this issue today, May 2017
docker for windows version 17.03.1-ce-win12 (12058)
Resolved it by unsharing C drive then resharing.
Hopefully that helps someone

It worked to me by unclick (Unshare) apply and click (share again) and apply worked.
I never expected to work but simple enough works.. I should have tried this method first.

@VanVan
Copy link

VanVan commented Feb 26, 2020

On my side, unshare and share again from Docker Desktop settings prevents docker from restarting and makes it crash, a restart of the machine is necessary.
I guess this bug will never be fixed, until we migrate to WSL2.

@tarunjuneja
Copy link

Don't rush - Read it carefully

So guys i spent whole day, whole night fixing this problem and finally i got the problem

Here i am mapping my webapp folder to node on folder docker
docker run -v d://Work/sample/nxt/examples/webapp:/node -u 0 --rm --name=dockername -it -p 8080:8080 somepath/dockername

See d:// here, if you have a drive and so colon in it it must be //

Also Make sure don't mount using $PWD on windows somehow it does not map to correct path. Use physical path as i have shown above

I am sure it will make many days of many folks

Happy coding

Cheers!

@abbasnikbakht
Copy link

Don't rush - Read it carefully

So guys i spent whole day, whole night fixing this problem and finally i got the problem

Here i am mapping my webapp folder to node on folder docker
docker run -v d://Work/sample/nxt/examples/webapp:/node -u 0 --rm --name=dockername -it -p 8080:8080 somepath/dockername

See d:// here, if you have a drive and so colon in it it must be //

Also Make sure don't mount using $PWD on windows somehow it does not map to correct path. Use physical path as i have shown above

I am sure it will make many days of many folks

Happy coding

Cheers!

Thanks, this helped me.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jun 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests