in DevOps

Mount Windows folder to Boot2Docker VM

I just stumbled over a post on Stackoverflow ( with the question how to mount a Windows folder to a Boot2Docker VM. Although the steps are a little bit confusing, in the end it is not difficult to do.


Boot2Docker is a simple VM to run Docker. The VM will run on VirtualBox and Boot2Docker is just a tool to provision this VM (very similar to Vagrant, but smaller and customized for using Docker). You simply download and install Boot2Docker and run boot2docker up to start the VM. After the VM is up, you can run boot2docker ssh to login. Now, we can start to get our Windows folder.

Mounting the folder

To use one of your Windows folders in your Boot2Docker VM, you need to mount it. To do so, you mount your Windows folder to the VM:

Now you login to your VM via SSH (with boot2docker ssh) and do the following:

Make a folder inside your VM:

Mount your stuff from Windows:

After that, you can access c:/my/folder/with/code inside your Boot2Docker VM:

Now, that your code is present inside your VM, you can use it with Docker. Either by mounting it as a volume to the container:

Or by using it while building your Docker image:

Best regards,

Write a Comment


  1. I spend an hour mounting windows folder in boot2docker. In your example parameters should be reversed

    sudo mount -t vboxsf /opt/my/folder/with/code /my_windows_folder

    instead it should be

    sudo mount -t vboxsf /my_windows_folder /opt/my/folder/with/code

    • I’m sorry that you had trouble with mounting your folder. I checked my post and I actually think the commands are correct: mount -t vboxsf . However, it’s easy to get confused and mixing up the folders (maybe my naming isn’t perfect right here). But if you want to mount your shared folder (the ) as /my_windows_folder you should use this:

      sudo mount -t vboxsf /opt/my/folder/with/code /my_windows_folder

      You can use the VirtualBox UI to validate if your shared folder is really added under the name “/opt/my/folder/with/code”.

  2. You can also do the creation of the shared folder by the VirtualBox Manager GUI.
    Then you have to connect with “docker-machine ssh $VM_NAME” and run the command “sudo mound -t vboxsf $SHARED_FOLDER_NAME /path/to/mount/point”

    The rest works as described.

    I used this with installed Docker Toolbox 1.12.0 on Windows 7.