Docker Community Forums

Share and learn in the Docker community.

Map windows directory to docker container


(Jay) #1

Hello Everyone,

I’m new to docker. i have seen some answer online on forum to map windows directory to docker container. Basically i’m trying to map my windows directory using command “docker run -v //c/users/username/junos:/usr/src carrozzi/juise:latest”. So i can run slax script on container as i’m running on juise CLI. Am i doing something wrong with command or i need any further step? Any help on this would be appreciated.


(Xi Shen) #2

On Windows, you can not directly map Windows directory to your container. Because your containers are reside inside a VirtualBox VM. So your docker -v command actually maps the directory between the VM and the container.

So you have to do it in two steps:

  1. Map a Windows directory to the VM through VirtualBox manager
  2. Map a directory in your container to the directory in your VM

You better use the Kitematic UI to help you. It is much eaiser.

(Jay) #3

Hi Xi ,

Thanks for your reply.

I have set windows directory path in VirtualBox in Shared folder. I also map container directory using this command “docker run -v /c/Users/username/junos:/usr/src carrozzi/juise:latest”. But still problems remains same when i tried to execute script. Please assist me on this if i’m doing something wrong on mapping windows directory to container directory.

(Xi Shen) #4

Hi Jay,

Did the command succeed, but did not map the volume? What was the particular error/symptom?

If you do

docker-machine ssh default

Can you see the mapped volume from within the VM?


(Jay) #5

Yes command succeed. Doesn’t shows up any error on terminal.

When i did “docker-machine ssh default” and applied “ls” command nothing shows up on the terminal. so i can’t see mapped volume within the VM.

(Boistordu) #6

sorry to ask you that, but I’m new to docker and I have my system on ssd And I need to mount then a directory on a bigger disk on a container that I’ve downloaded in the hub.
So I’ve had the directory in the shared folders in the default vm in virtualbox manager and now I don’t really know what to do next. You said to use kitematic but kitematic only accept subfolders of c:\Users… so how to do it here? And shouldn’t I need to map in fstab or something of the default vm the new directory that I’ve put in the virtualbox manager?
best regards