Docker Community Forums

Share and learn in the Docker community.

Bind Mounts Empty in Docker Toolbox

I’m using Docker Toolbox on Windows, since I can’t use Docker for Windows on my machine. My issue is with the following command:

docker container run -it --rm -v database_mongodb_data:/data/db -v $(pwd):/backup ubuntu bash

With the second-v flag, I want to bind my current working directory to the container as a volume, to copy some data from the host machine into the container. The PWD is located under C://Users/…, it contains a number of files, and I made sure that my Docker Quickstart Terminal is cd’d to that directory. The container runs fine, it has the /backup directory, but that directory is empty.

This is a fresh install of Docker Toolbox (v18.09.3), on Windows 10. I use the above command in a script, which I’ve been using on older installations for the last couple of months, without a problem. Does anyone have an idea what the matter might be?

Edit: when I run this command directly under C://Users/myname, the container’s /backup directory can see one of the folders in my host’s “home”, but only one. It can also see one subfolder of that, and one subfolder of the subfolder, but that’s it. It doesn’t see all the directories, and none of the files. Could this be a permission problem?

Edit 2: The same thing stated in the first edit is also true when I SSH into the docker-machine and cd into /c/Users/myname. The machine sees one directory in there, with one sub- and one sub-subdirectory, but nothing more, and no files.
.

Problem solved! After trying out older releases of Docker Toolbox, the following steps solved my problem:

  1. Uninstall Docker Toolbox
  2. remove the “default” VM in VirtualBox
  3. Install the latest version of VirtualBox (currently Version 6.0.10 r132072) - I think this was the issue here
  4. Install the latest version of Docker Toolbox again (currently v18.09.3)

It seems to me like the older version of VirtualBox shipped with Docker Toolbox had some issues with shared folders, not quite sure why. Anyway, it works now :).

Edit: While I was searching for a solution to this problem, I also set the connection type of my network connection from public (as it was set by default) to private. It’s also possible that this fixed the issue.

2 Likes

Hi i have the same problem, i have a folder under C:/Users/
which is used as a volume of one of my containers when i run docker-compose up -d
the problem is after a few restarts it suddenly stopped working.

i checked the virtual box, C:/Users is still a shared folder, the local folder that needs to be added as a volume is still under C:/Users but somehow it doesn’t mount the contents of my folder.

i am using the latest docker toolbox --> [v18.09.3] and tried installing it with the latest VM, but the docker toolbox does not start if this version is being used .

i hope someone else has the same issue i am so confused and i am on this for some days now.

Same problem using Docker Toolbox on Windows 8.1.
And your solution fixed the issue (Install VirtualBox 6.0…).
Thanks!