Docker Community Forums

Share and learn in the Docker community.

Can't set Docker Volume for Container in Windows Docker CE

docker

(Danj210) #1

I’ve been scouring the forums and looking through a lot of posts, trying out the commands I’ve seen from other people but I do not get the results that they do. I have no idea what I’m doing run. I’ll share the link I’m getting a lot of commands from Volume mounts in windows does not work

When I run docker run -v c:/Users:/data alpine ls /data or any combination of -v … I get the errors
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid bind mount spec "c:/Users:/data": invalid volume specif ication: 'c:\Users:\data'. See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

So I cannot figure out what’s happening that’s wrong but I cannot bind any volume in so many ways I’ve tried.


(Sujaypillai) #2

Did you enable the Drive to be shared with the container by going into Settings >> Shared Drives?


(Henr7) #3

I had the same problems under windows using git bash.
Try using Windows Power Shell for issuing the docker run command!

Henry


(Klday) #5

I am getting the same error using Power Shell and I checked that my C drive is shared with Docker. Any other thoughts on what could be causing this?


(Eric Ongerth) #6

It’s just a syntax problem. The colon : character is already reserved as the delimiter between the host directory and guest directory when you use run -v. So you can either leave out the host drive letter and just specify the host path as /Users, or use the alternative syntax of /c/Users. Then you will only have one : character in your -v and you won’t confuse docker.


(Jnupur) #7

Thanks . :slight_smile: