docker-archive / toolbox

The Docker Toolbox
https://docker.com/toolbox
3.22k stars 1.23k forks source link

Bind mount results as empty volume with Windows 7 host #877

Open rmauget opened 4 years ago

rmauget commented 4 years ago

Hello,

I am using Docker Toolbox (v19.03.1) and VirtualBox (v5.2.20 - included in Docker Toolbox installer) under a Windows 7 laptop. And I use Docker Compose to start the containers.

I would like to use a bind mount of an host directory in my container but I encounter the following problem.

Here is an extract of the .env file:

...
PITCH_RTI_HOME=C:\Program Files\prti1516e

Here is an extract from the docker compose file:

...
  tc-runner:
    image: ivct/tc-runner:pi-skeleton-${IVCT_VERSION}
    depends_on:
...
    volumes:
...
    - ${PITCH_RTI_HOME}:/usr/local/lrc/code
    environment:
...

So, when I start the tc-runner container, the C:\Program Files\prti1516e directory from host (Windows) machine is mounted in the container. I have checked the list of mounted volumes using the following command: docker inspect -f "{{ .Mounts }}" [container ID] The result is:

[{volume host-advertise-network_ts-hla-declaration /mnt/sda1/var/lib/docker/volumes/host-advertise-network_ts-hla-declaration/_data /root/conf/TestSuites/TS_HLA_Declaration-2.1.0 local nocopy true }
...
{bind  /c/Program Files/prti1516e /usr/local/lrc/code  rw true rprivate}
...

The problem is that the content of the /usr/local/lrc/code is empty, whereas the content of C:\Program Files\prti1516e directory on the host computer is not empty. So, bind mount does not work.

I have a look at equivalent issues, such as issues #607 (environment variable COMPOSE_CONVERT_WINDOWS_PATHS is set to TRUE), #729 (I have tried to share the directory with VM) and #796 (I am using an absolute path name, not a relative path name), but none of those solved the problem.

Any help welcome!

rashid-test commented 4 years ago

@rmauget I suppose you have to set up shared folders in VirtualBox 'default' machine (the one is being launched). By default "C:\Program Files\prti1516e" is unacceptable.

OR - you may move mentioned folder into C:\Users which is shared by default. Like C:\Users\prti1516e for instance. It should work that way. At least try it.